<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"/>
    <meta name="description" content="tar:将许多文件一起保存至一个单独的磁带或磁盘归档，并能从归档中单独还原所需文件。 - 最专业的Linux命令大全，内容包含Linux命令手册、详解、学习，值得收藏的Linux命令速查手册。">
    <meta name="keywords" content="Linux,Command,命令大全,Linux命令手册,tar,将许多文件一起保存至一个单独的磁带或磁盘归档，并能从归档中单独还原所需文件。">
    <title>tar 命令，Linux tar 命令详解：将许多文件一起保存至一个单独的磁带或磁盘归档，并能从归档中单独还原所需文件。 -  Linux 命令搜索引擎</title>
    <link rel="shortcut icon" href="../img/favicon.ico">
    <link rel="stylesheet" type="text/css" href="../css/index.css?v=1682353717438">
    <script src="../js/dark-mode.min.js"></script>
    <script type="module" src="../js/github-corners.js"></script>
</head>
<body>
<dark-mode permanent dark="夜晚" light="白天" style="position: fixed;left: 10px;top: 8px; z-index: 999;"></dark-mode>
<github-corners target="__blank" z-index="999" position="fixed" href="https://gitee.com/flamez57/linux-command-collection"></github-corners>
 <style>
:host a:hover .octo-arm { animation: octocat-wave 560ms ease-in-out; }
@keyframes octocat-wave {
  0%, 100% { transform: rotate(0); }
  20%, 60% { transform: rotate(-25deg); }
  40%, 80% { transform: rotate(10deg); }
}
@media (max-width:500px) {
  :host a:hover .octo-arm { animation: none; }
  :host .octo-arm { animation: octocat-wave 560ms ease-in-out; }
}
:host svg {
  z-index: 99;
  position: fixed;
  border: 0px;
  top: 0px;
}
</style>
<svg width="54" height="54" viewBox="0 0 250 250" aria-hidden="true" target="__blank" style="z-index: 999; position: fixed; right: 0px;">
  <a xlink:href="" target="_blank" rel="nofollow sponsored" style="fill: rgb(21, 21, 19); color: rgb(255, 255, 255);">
    <g>
      <!-- <path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path> -->
      <path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2" fill="currentColor" class="octo-arm" style="transform-origin: 130px 106px;"></path>
      <path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z" fill="currentColor" class="octo-body"></path>
    </g>
  </a>
</svg>
</template></github-corners>
<div class="header header_list">
  <div class="header_inner">
      <div class="logo">
          <a href="../index.html">
            <svg width="183px" height="48px" viewBox="0 0 183 48" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <!-- Flamez57 <flamez57@qq.com> https://gitee.com/flamez57 --> <title>logo</title> <desc>Linux Command Logo. https://gitee.com/flamez57</desc><g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"> <g transform="translate(-576.000000, -261.000000)" fill="currentColor"> <g id="logo" transform="translate(576.000000, 261.000000)"> <path d="M20.4917792,0.000336524232 C20.1886146,-0.000100520225 19.8723998,0.0124863601 19.542641,0.0387964365 C11.2083649,0.710004944 13.4186692,9.51473754 13.2949769,12.4631618 C13.1427718,14.6193207 12.7056049,16.3185233 11.2226825,18.426428 C9.48047033,20.4982285 7.02763261,23.8514609 5.86566251,27.3420607 C5.3172635,28.9894735 5.05630425,30.6686289 5.29730805,32.2578406 C5.22181299,32.325447 5.14994103,32.3962788 5.08160039,32.469239 C4.57008792,33.0153217 4.19213625,33.6769851 3.77100458,34.1224689 C3.37755968,34.5149436 2.81698897,34.6642292 2.20097918,34.8852382 C1.58472464,35.1063477 0.908127379,35.4323261 0.497432332,36.2204265 C0.497432332,36.2204265 0.497432332,36.2207368 0.49712203,36.2207368 C0.496684986,36.222048 0.495373852,36.2233591 0.494936808,36.2246702 L0.494936808,36.2246702 C0.123151829,36.919077 0.233680372,37.718746 0.347224522,38.4596325 C0.460773043,39.2004972 0.575720105,39.9005856 0.423139144,40.3755699 C-0.0645762474,41.7086473 -0.126850712,42.6307542 0.216491414,43.2996202 C0.560563403,43.9698759 1.2680029,44.2657113 2.06756262,44.432706 C3.66668644,44.7666954 5.83232039,44.6837094 7.53908826,45.5883128 L7.68579097,45.3115063 L7.54060917,45.5891344 C9.36778716,46.5444437 11.2201913,46.8837519 12.698079,46.5461831 C13.7695766,46.3014513 14.6393781,45.6634363 15.0860725,44.6816946 C16.2420201,44.6760567 17.5104717,44.1864315 19.5423657,44.0745568 C20.9208039,43.9635213 22.6427241,44.564051 24.6233484,44.4540775 C24.6751207,44.6689591 24.750052,44.8756375 24.8526175,45.0720452 C24.8539287,45.0742305 24.8548028,45.0759786 24.8556769,45.0780328 C25.6234722,46.6133699 27.0500902,47.3156173 28.570428,47.1956355 C30.0927718,47.075492 31.711331,46.1778551 33.0196848,44.6208231 L32.7798304,44.4192582 L33.0215204,44.618616 C34.2685787,43.1065034 36.3384911,42.4794975 37.7110118,41.6516741 C38.3972721,41.2377581 38.9541192,40.7194802 38.9971462,39.966706 C39.0401514,39.2142991 38.5984218,38.3711223 37.5826868,37.2436088 L37.5823765,37.2432985 C37.5820662,37.2428614 37.5815024,37.2424244 37.5810654,37.2415503 C37.2473295,36.8644028 37.0881185,36.1654026 36.91702,35.4210285 C36.7460395,34.6771089 36.5551865,33.8746254 35.9444344,33.3545687 L35.9444344,33.3545687 C35.9431233,33.3532575 35.9418121,33.3523835 35.940938,33.3515094 L35.940938,33.3515094 C35.6978714,33.1397045 35.4452772,32.9959518 35.1909042,32.8993694 C36.0400422,30.3810493 35.7068789,27.8734149 34.8497254,25.6073831 C33.7977638,22.8263338 31.9611937,20.4030752 30.5585738,18.7453569 C28.9885703,16.7650385 27.4529665,14.8848863 27.4832187,12.1079627 C27.5299825,7.86977213 27.9494053,0.0101787654 20.4914689,0 L20.4917792,0.000336524232 Z M21.5014393,6.5296802 C21.9246338,6.5296802 22.2860696,6.65372652 22.6573476,6.92320377 C23.0345213,7.1969553 23.3062494,7.53965497 23.5252523,8.01821865 C23.7401952,8.48461502 23.843613,8.94086321 23.8537568,9.48229573 C23.8537568,9.49649968 23.8537568,9.50864951 23.8576902,9.52285346 C23.8616236,10.0784681 23.7664397,10.5509481 23.5555483,11.0335676 C23.4352081,11.3089536 23.2970146,11.540089 23.1316064,11.7401941 C23.0754506,11.7132285 23.0171357,11.6873118 22.9566488,11.6624396 L22.9566488,11.6624396 C22.5373789,11.4828667 22.2157491,11.3685884 21.9476879,11.2755722 C22.044856,11.158772 22.1257661,11.0202464 22.1969169,10.8470719 C22.3043949,10.5854877 22.3571155,10.3299784 22.367255,10.025813 C22.367255,10.0136631 22.3711884,10.00348 22.3711884,9.98931975 C22.3772633,9.69732161 22.3387597,9.44789596 22.2535753,9.19239103 C22.1643483,8.92472316 22.0507955,8.73208707 21.886541,8.57188842 C21.722291,8.41168541 21.5580366,8.33869024 21.361336,8.33260221 C21.3521143,8.33216517 21.3429364,8.33216517 21.3338459,8.33216517 C21.1488275,8.33260221 20.9881699,8.39616596 20.8219532,8.53532529 C20.6475593,8.6813331 20.5177834,8.86788115 20.4103054,9.12744186 C20.3028318,9.38699819 20.2501067,9.64452664 20.239976,9.95073309 C20.2377908,9.96288293 20.2377908,9.97306607 20.2377908,9.9852159 C20.2342945,10.1535261 20.2449584,10.307711 20.2709188,10.4574381 C19.8923378,10.2687966 19.535574,10.1401875 19.2007499,10.0604924 C19.181651,9.91570835 19.1706375,9.76629596 19.1670975,9.61007442 L19.1670975,9.56750629 C19.1610225,9.01391519 19.2522643,8.53941165 19.4651836,8.05679657 C19.6781029,7.57417712 19.9417194,7.2274173 20.3128051,6.94555422 C20.6838952,6.66369114 21.0488973,6.53391079 21.4808239,6.52985938 L21.5010154,6.52985938 L21.5014393,6.5296802 Z M15.7091362,6.98827969 C15.9898804,6.98871673 16.2410892,7.0827381 16.5009296,7.29023807 C16.7828014,7.51531597 16.9957164,7.80326271 17.1741616,8.20882685 C17.3526112,8.614391 17.4479175,9.01995077 17.4742757,9.49851445 L17.4742757,9.50244785 C17.4870374,9.70344023 17.485464,9.89263677 17.469643,10.0758677 C17.4141165,10.091645 17.3597045,10.1087334 17.3064069,10.1270762 C17.0036968,10.2312719 16.7369205,10.373272 16.5044085,10.5268101 C16.5271785,10.366205 16.5305437,10.2032486 16.5131057,10.0215605 C16.5109204,10.0114211 16.5109204,10.0032921 16.5109204,9.99319633 C16.4865771,9.75189098 16.435893,9.54911109 16.3507218,9.34429895 C16.2594713,9.131384 16.1580813,8.98132478 16.0242452,8.86573527 C15.9029566,8.76098882 15.7883592,8.71289208 15.6622806,8.71384046 C15.6492567,8.71384046 15.636058,8.71427751 15.6227281,8.71558864 C15.4807804,8.72773848 15.3631674,8.79669098 15.251638,8.93255936 C15.1401086,9.068419 15.0671091,9.23672919 15.0143884,9.4597792 C14.9616634,9.68284232 14.9474682,9.90184967 14.9697706,10.1532945 C14.9697706,10.1634339 14.9719558,10.1715629 14.9719558,10.1816586 C14.9962992,10.4249963 15.0449553,10.6277718 15.1321501,10.8325883 C15.2213771,11.0434797 15.3247905,11.1935346 15.4586266,11.3091153 C15.481047,11.3284764 15.5032139,11.3458708 15.525289,11.361399 C15.3860816,11.468536 15.3196072,11.5179308 15.2055298,11.6017559 C15.1323642,11.6554425 15.0452263,11.7193646 14.94395,11.7940162 C14.7230765,11.5871106 14.5507673,11.3270648 14.4001137,10.984671 C14.2216641,10.5791112 14.1263578,10.1735471 14.0979674,9.69498342 L14.0979674,9.69105002 C14.0716136,9.21249508 14.1182463,8.8008429 14.2500545,8.37500864 C14.3818627,7.94916563 14.5582845,7.6409444 14.813785,7.38745861 C15.06929,7.13399031 15.3268184,7.00623784 15.6370763,6.99001912 C15.6613322,6.98870799 15.6853347,6.98827095 15.709123,6.98827095 L15.7091362,6.98827969 Z M18.3434478,10.3083666 C18.9959552,10.3057443 19.7811624,10.5197693 20.731756,11.1309629 C21.3156605,11.5106715 21.7700031,11.5424053 22.8162176,11.9904939 L22.8175288,11.9909309 L22.8188399,11.991368 C23.322219,12.1979021 23.6176741,12.4671083 23.7620255,12.7505841 C23.906377,13.034073 23.9099039,13.3414857 23.7890786,13.6648724 C23.5474411,14.3116676 22.7761407,14.9923468 21.6937826,15.3303395 L21.6929085,15.3307766 L21.6920344,15.3312136 C21.1642857,15.5026793 20.7040867,15.8813302 20.1615484,16.1915706 C19.6190277,16.5017979 19.00512,16.7520102 18.1703739,16.7037212 C18.1703739,16.7037168 18.1703739,16.7037212 18.1703739,16.7037212 C17.4597396,16.6622893 17.0349499,16.4210539 16.650849,16.1123607 C16.2667437,15.8036631 15.9320245,15.4158517 15.4418966,15.1280491 L15.4405854,15.1271751 L15.4392743,15.126301 C14.6497885,14.6800742 14.2187709,14.163964 14.0834969,13.7165354 C13.9482185,13.2691068 14.075193,12.8871911 14.4668766,12.5936327 C14.9072645,12.2635986 15.2131825,12.0390976 15.4169632,11.8895453 C15.6194022,11.7409983 15.703625,11.685297 15.7680935,11.623394 C15.7684038,11.622957 15.7685305,11.622957 15.7689675,11.6225199 L15.7692735,11.6220829 C16.1001729,11.3088706 16.6276463,10.738226 17.4227569,10.4645313 C17.696421,10.3703264 18.001784,10.3095466 18.3435746,10.3081961 L18.3434478,10.3083666 Z M22.9062619,13.0069369 C22.6246829,13.0237631 22.3297828,13.1687002 21.9864013,13.3604054 C21.6430199,13.5521105 21.256878,13.7973406 20.8384079,14.0388338 C20.0014721,14.5218204 19.038047,14.9837283 18.0805918,14.9837283 C17.1216551,14.9837283 16.3555118,14.5408493 15.7808726,14.0854752 C15.4935509,13.8577838 15.2564149,13.6284404 15.0669561,13.4510265 C14.9722311,13.3623109 14.8900799,13.2867065 14.8134179,13.2276487 C14.7367734,13.1685909 14.6743853,13.1100357 14.5461303,13.1100357 L14.5400116,13.3795435 C14.5308337,13.4697233 14.5213935,13.4669437 14.5251084,13.4693999 C14.5310959,13.4733333 14.5608587,13.4835601 14.5955731,13.5103509 C14.6519344,13.5537495 14.7301609,13.6245375 14.8230067,13.7114832 C15.0086981,13.8853788 15.2554403,14.124464 15.5592255,14.3652012 C16.166796,14.8466668 17.0117515,15.3406363 18.0806093,15.3406363 C19.1509618,15.3406363 20.1636375,14.8403471 21.016875,14.3479598 C21.4434872,14.1017639 21.8309534,13.8560094 22.1604324,13.6720705 C22.4898897,13.4881185 22.7670895,13.3727781 22.9275766,13.3632068 L22.9062925,13.00695 L22.9062619,13.0069369 Z M23.8576858,14.2878093 C24.5685911,17.0901733 26.2220701,21.1378562 27.2848005,23.113201 C27.8496849,24.1612205 28.9735097,26.3878921 29.4590574,29.0706371 C29.7667148,29.0611969 30.1054855,29.1059065 30.4682673,29.1987042 C31.7377591,25.907589 29.3917525,22.3626165 28.3189832,21.375368 C27.8858722,20.9551061 27.8650557,20.7668098 28.0797669,20.7757081 C29.2436775,21.8049915 30.7716374,23.8752142 31.3275492,26.211938 C31.581035,27.2774436 31.6350799,28.3975886 31.3630809,29.5030663 C31.4961478,29.5583437 31.6312951,29.6184504 31.7682604,29.683286 C33.806037,30.6755779 34.5596721,31.5384567 34.1973186,32.716121 C34.0779748,32.7117506 33.960576,32.7126247 33.8460659,32.7152469 C33.8354021,32.7155572 33.8247819,32.715684 33.814118,32.716121 C34.1092104,31.7826203 33.4554837,31.0941179 31.7135031,30.305952 C29.9067264,29.5110511 28.4669839,29.5901387 28.2236507,31.2022427 C28.2080919,31.2867016 28.1955487,31.3727644 28.1860212,31.460029 C28.05104,31.506902 27.9153158,31.5667509 27.7792552,31.6412014 C26.9308557,32.1054213 26.4677896,32.9477371 26.2102393,33.9808403 C25.9529032,35.0131131 25.8791213,36.2610673 25.8081016,37.6639101 L25.8081016,37.6647842 C25.7647031,38.3701826 25.4746935,39.3242507 25.1805582,40.3347805 C22.2207839,42.446033 18.1128938,43.3607409 14.6251435,40.9805006 C14.3887768,40.6065916 14.1176344,40.2361221 13.8385378,39.8707355 C13.6603154,39.6373843 13.4772332,39.4054841 13.2952172,39.1768225 C13.6532528,39.1768225 13.9575843,39.1184771 14.2035442,39.0069433 C14.5094142,38.8682516 14.724322,38.6454901 14.8306462,38.3594969 C15.0432858,37.7875325 14.8297721,36.9806654 14.1489836,36.0592664 C13.4682956,35.137933 12.3154554,34.0981212 10.6214273,33.0592009 C10.6214273,33.0592009 10.621117,33.0592009 10.621117,33.0588906 C9.37658486,32.2846183 8.68057408,31.3355981 8.3547924,30.3051959 C8.02898013,29.2747018 8.07466439,28.1604089 8.32577265,27.0602631 C8.80774091,24.9485692 10.0461107,22.8947793 10.8362565,21.605909 C11.0489879,21.4493815 10.9122629,21.8964561 10.0363515,23.5230089 C9.25134103,25.0101357 7.78376323,28.4420972 9.79314068,31.1210705 C9.84684033,29.2145776 10.3021401,27.2701931 11.0664741,25.45145 C12.1797968,22.9278068 14.5084483,18.5514927 14.6933968,15.0635108 C14.7887555,15.1327561 15.1164383,15.3538525 15.2624505,15.4368866 C15.2627608,15.4373237 15.2628875,15.4373237 15.2633246,15.4373237 C15.6905181,15.6888908 16.0113611,16.0566244 16.426903,16.3905832 C16.8432709,16.7252019 17.3634237,17.0142238 18.149269,17.0600129 L18.149269,17.0600129 C19.066516,17.113092 19.7655905,16.8289912 20.3383504,16.5014745 C20.9102449,16.1744603 21.3671137,15.8125482 21.7999582,15.6712779 C21.8003952,15.6708409 21.8012693,15.6708409 21.8017063,15.6708409 C22.7163355,15.3848215 23.44356,14.8785842 23.857393,14.2881327 L23.8576858,14.2878093 Z M29.6669682,30.3312962 C30.0374289,30.329548 30.4861993,30.4530917 30.9774372,30.6728508 C32.2995623,31.2832227 32.713238,31.8063999 32.3522873,32.5749338 C32.0481219,33.1548918 30.7462669,34.0775407 29.8540319,33.8342075 C28.9435503,33.5989814 28.4994564,32.2869871 28.6474877,31.2953987 C28.7267763,30.6220356 29.1076387,30.3339097 29.6669682,30.3312962 L29.6669682,30.3312962 Z M28.1710786,32.1433306 C28.2458176,33.3559191 28.8457529,34.5926195 29.9067526,34.8602742 C31.0678224,35.1661922 32.7418469,34.16998 33.4486352,33.3574182 C33.5895689,33.3517803 33.7273516,33.3448313 33.8611658,33.3416409 C34.4811527,33.3266503 35.001157,33.3620509 35.5324588,33.8267253 L35.534207,33.8284735 L35.5359552,33.8302216 C35.9442465,34.1761336 36.1383204,34.8298385 36.3066481,35.5621545 C36.4749627,36.294475 36.6095636,37.0920505 37.11435,37.6602345 L37.115224,37.6611086 L37.1156611,37.6619827 C38.0861227,38.7388952 38.3980544,39.4668146 38.3715083,39.931406 C38.344936,40.3960279 38.008556,40.7409347 37.3873891,41.1155867 C36.1455928,41.864576 33.9453056,42.5158727 32.5399192,44.2181871 C31.3196037,45.6704378 29.8315635,46.4680352 28.5210638,46.5714617 C27.2105642,46.6748883 26.0799127,46.1309646 25.4133237,44.793071 L25.4115756,44.7900117 L25.4098274,44.7869524 C24.9962959,44.0002986 25.1685614,42.758852 25.5169207,41.4493706 C25.8652845,40.1398937 26.3657922,38.7953264 26.4327911,37.7024923 L26.4327911,37.7007442 L26.4327911,37.698996 C26.5036666,36.2987755 26.5820418,35.0759688 26.8172504,34.1324728 C27.0524633,33.1889769 27.4228236,32.5499829 28.0790545,32.1909116 C28.109604,32.1742165 28.139948,32.1584392 28.1701128,32.1435097 L28.1710786,32.1433306 Z M6.86074718,32.2348346 C6.95869322,32.2351449 7.06234705,32.2434006 7.17277507,32.2601394 C7.91559769,32.3726653 8.5633675,32.8920358 9.18746261,33.7385341 C9.8115621,34.5850455 10.3922762,35.7405823 10.9892352,37.0223812 L10.9901093,37.0241294 L10.9905463,37.0258776 C11.4702594,38.0271115 12.4825418,39.128044 13.3403902,40.2511564 C14.1982341,41.3742689 14.8621527,42.5016163 14.7756966,43.3644732 L14.7753863,43.3684066 L14.775076,43.37234 C14.6632363,44.843978 13.8330966,45.6451198 12.5587449,45.9361914 C11.2847734,46.2271625 9.55771794,45.9379396 7.83269472,45.035587 L7.83094655,45.035587 C5.9224477,44.0247687 3.65205856,44.1251622 2.19566909,43.8209924 C1.46727769,43.6688572 0.99200058,43.44013 0.773862951,43.0151698 C0.55571221,42.5902315 0.550839164,41.8488511 1.01440785,40.5847437 L1.01659307,40.5791059 L1.01834125,40.573468 C1.24759292,39.8663213 1.07793226,39.0925822 0.96663015,38.3663367 C0.855328038,37.6400911 0.800894151,36.9795116 1.04888192,36.5190765 L1.05019305,36.5168913 L1.05150418,36.514706 C1.36900824,35.9026821 1.83472718,35.683902 2.41273159,35.4765375 C2.990736,35.2691556 3.67612223,35.1062953 4.21734934,34.5638925 L4.21997161,34.5612703 L4.22259387,34.558648 C4.72293985,34.0308163 5.09877623,33.3691834 5.53863963,32.8995879 C5.90977341,32.5033678 6.28118253,32.2407652 6.84099715,32.2368755 L6.86053303,32.2368755 L6.86074718,32.2348346 Z"></path> <path d="M58.5014648,40 L58.5014648,6.7578125 L65.4194336,6.7578125 L65.4194336,35.2832031 L80.4008789,35.2832031 L80.4008789,40 L58.5014648,40 L58.5014648,40 L58.5014648,40 Z M86.2524414,40 L86.2524414,15.3378906 L92.9008789,15.3378906 L92.9008789,40 L86.2524414,40 L86.2524414,40 L86.2524414,40 Z M86.2524414,11.1826172 L86.2524414,5.63476562 L92.9008789,5.63476562 L92.9008789,11.1826172 L86.2524414,11.1826172 L86.2524414,11.1826172 L86.2524414,11.1826172 Z M100.211426,40 L100.211426,15.3378906 L106.859863,15.3378906 L106.859863,19.9873047 C109.031098,16.513329 111.8312,14.7763672 115.260254,14.7763672 C117.461437,14.7763672 119.198399,15.4726493 120.471191,16.8652344 C121.743984,18.2578195 122.380371,20.1594932 122.380371,22.5703125 L122.380371,40 L115.731934,40 L115.731934,24.2099609 C115.731934,21.4098167 114.803557,20.0097656 112.946777,20.0097656 C110.835439,20.0097656 108.806488,21.4996596 106.859863,24.4794922 L106.859863,40 L100.211426,40 L100.211426,40 L100.211426,40 Z M145.672363,40 L145.672363,35.3505859 C143.516102,38.8245616 140.716,40.5615234 137.271973,40.5615234 C135.07079,40.5615234 133.333828,39.8652413 132.061035,38.4726562 C130.788242,37.0800712 130.151855,35.1783975 130.151855,32.7675781 L130.151855,15.3378906 L136.800293,15.3378906 L136.800293,31.1279297 C136.800293,33.9280739 137.736156,35.328125 139.60791,35.328125 C141.704275,35.328125 143.725739,33.838231 145.672363,30.8583984 L145.672363,15.3378906 L152.320801,15.3378906 L152.320801,40 L145.672363,40 L145.672363,40 L145.672363,40 Z M158.003418,40 L166.471191,27.6240234 L158.362793,15.3378906 L165.932129,15.3378906 L171.23291,23.1542969 L176.309082,15.3378906 L181.699707,15.3378906 L173.973145,27.4443359 L182.26123,40 L174.691895,40 L169.166504,31.8466797 L163.506348,40 L158.003418,40 L158.003418,40 L158.003418,40 Z"></path> </g> </g> </g> </svg> 
          </a>
      </div>
      <div class="search">
          <ul class="search-list" id="result">
            <!-- <li><a href="#"><strong>find</strong> - 指定目录下查找文件。</a></li> -->
          </ul>
          <input type="text" class="query" id="query" autocomplete="off" autofocus="autofocus" placeholder="Linux 命令搜索"/>
          <div class="enter-input">
              <input type="hidden" id="current_path" value="/c/tar.html">
              <button id="search_btn">搜索</button>
          </div>
      </div>
  </div>
</div>
<script type="text/javascript" src="../js/copy-to-clipboard.js"></script>

<div class="markdown-body">

<span class="edit_btn"> <span class="split"></span> </span>


<script>const __TEMPLATE__ = document.createElement('template');
__TEMPLATE__.innerHTML = `
<style>

markdown-style h1:hover a.anchor .octicon-link:before,
markdown-style h2:hover a.anchor .octicon-link:before,
markdown-style h3:hover a.anchor .octicon-link:before,
markdown-style h4:hover a.anchor .octicon-link:before,
markdown-style h5:hover a.anchor .octicon-link:before,
markdown-style h6:hover a.anchor .octicon-link:before {
  width: 16px;
  height: 16px;
  content: ' ';
  display: inline-block;
  background-color: currentColor;
  -webkit-mask-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' version='1.1' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg>");
  mask-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' version='1.1' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg>");
}
[data-color-mode*='light'], [data-color-mode*='light'] body, markdown-style[theme*='light'] { --color-prettylights-syntax-comment: #6e7781; --color-prettylights-syntax-constant: #0550ae; --color-prettylights-syntax-entity: #8250df; --color-prettylights-syntax-storage-modifier-import: #24292f; --color-prettylights-syntax-entity-tag: #116329; --color-prettylights-syntax-keyword: #cf222e; --color-prettylights-syntax-string: #0a3069; --color-prettylights-syntax-variable: #953800; --color-prettylights-syntax-brackethighlighter-unmatched: #82071e; --color-prettylights-syntax-invalid-illegal-text: #f6f8fa; --color-prettylights-syntax-invalid-illegal-bg: #82071e; --color-prettylights-syntax-carriage-return-text: #f6f8fa; --color-prettylights-syntax-carriage-return-bg: #cf222e; --color-prettylights-syntax-string-regexp: #116329; --color-prettylights-syntax-markup-list: #3b2300; --color-prettylights-syntax-markup-heading: #0550ae; --color-prettylights-syntax-markup-italic: #24292f; --color-prettylights-syntax-markup-bold: #24292f; --color-prettylights-syntax-markup-deleted-text: #82071e; --color-prettylights-syntax-markup-deleted-bg: #FFEBE9; --color-prettylights-syntax-markup-inserted-text: #116329; --color-prettylights-syntax-markup-inserted-bg: #dafbe1; --color-prettylights-syntax-markup-changed-text: #953800; --color-prettylights-syntax-markup-changed-bg: #ffd8b5; --color-prettylights-syntax-markup-ignored-text: #eaeef2; --color-prettylights-syntax-markup-ignored-bg: #0550ae; --color-prettylights-syntax-meta-diff-range: #8250df; --color-prettylights-syntax-brackethighlighter-angle: #57606a; --color-prettylights-syntax-sublimelinter-gutter-mark: #8c959f; --color-prettylights-syntax-constant-other-reference-link: #0a3069; --color-fg-default: #24292f; --color-fg-muted: #57606a; --color-fg-subtle: #6e7781; --color-canvas-default: #ffffff; --color-canvas-subtle: #f6f8fa; --color-border-default: #d0d7de; --color-border-muted: hsla(210,18%,87%,1); --color-neutral-muted: rgba(175,184,193,0.2); --color-accent-fg: #0969da; --color-accent-emphasis: #0969da; --color-attention-subtle: #fff8c5; --color-danger-fg: #cf222e; } [data-color-mode*='dark'], [data-color-mode*='dark'] body, markdown-style[theme*='dark'] { --color-prettylights-syntax-comment: #8b949e; --color-prettylights-syntax-constant: #79c0ff; --color-prettylights-syntax-entity: #d2a8ff; --color-prettylights-syntax-storage-modifier-import: #c9d1d9; --color-prettylights-syntax-entity-tag: #7ee787; --color-prettylights-syntax-keyword: #ff7b72; --color-prettylights-syntax-string: #a5d6ff; --color-prettylights-syntax-variable: #ffa657; --color-prettylights-syntax-brackethighlighter-unmatched: #f85149; --color-prettylights-syntax-invalid-illegal-text: #f0f6fc; --color-prettylights-syntax-invalid-illegal-bg: #8e1519; --color-prettylights-syntax-carriage-return-text: #f0f6fc; --color-prettylights-syntax-carriage-return-bg: #b62324; --color-prettylights-syntax-string-regexp: #7ee787; --color-prettylights-syntax-markup-list: #f2cc60; --color-prettylights-syntax-markup-heading: #1f6feb; --color-prettylights-syntax-markup-italic: #c9d1d9; --color-prettylights-syntax-markup-bold: #c9d1d9; --color-prettylights-syntax-markup-deleted-text: #ffdcd7; --color-prettylights-syntax-markup-deleted-bg: #67060c; --color-prettylights-syntax-markup-inserted-text: #aff5b4; --color-prettylights-syntax-markup-inserted-bg: #033a16; --color-prettylights-syntax-markup-changed-text: #ffdfb6; --color-prettylights-syntax-markup-changed-bg: #5a1e02; --color-prettylights-syntax-markup-ignored-text: #c9d1d9; --color-prettylights-syntax-markup-ignored-bg: #1158c7; --color-prettylights-syntax-meta-diff-range: #d2a8ff; --color-prettylights-syntax-brackethighlighter-angle: #8b949e; --color-prettylights-syntax-sublimelinter-gutter-mark: #484f58; --color-prettylights-syntax-constant-other-reference-link: #a5d6ff; --color-fg-default: #c9d1d9; --color-fg-muted: #8b949e; --color-fg-subtle: #484f58; --color-canvas-default: #0d1117; --color-canvas-subtle: #161b22; --color-border-default: #30363d; --color-border-muted: #21262d; --color-neutral-muted: rgba(110,118,129,0.4); --color-accent-fg: #58a6ff; --color-accent-emphasis: #1f6feb; --color-attention-subtle: rgba(187,128,9,0.15); --color-danger-fg: #f85149; } markdown-style { display: block; -webkit-text-size-adjust: 100%; font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji"; font-size: 16px; line-height: 1.5; word-wrap: break-word; color: var(--color-fg-default); background-color: var(--color-canvas-default); } markdown-style details, markdown-style figcaption, markdown-style figure { display: block; } markdown-style summary { display: list-item; } markdown-style [hidden] { display: none !important; } markdown-style a { background-color: transparent; color: var(--color-accent-fg); text-decoration: none; } markdown-style a:active, markdown-style a:hover { outline-width: 0; } markdown-style abbr[title] { border-bottom: none; text-decoration: underline dotted; } markdown-style b, markdown-style strong { font-weight: 600; } markdown-style dfn { font-style: italic; } markdown-style h1 { margin: .67em 0; font-weight: 600; padding-bottom: .3em; font-size: 2em; border-bottom: 1px solid var(--color-border-muted); } markdown-style mark { background-color: var(--color-attention-subtle); color: var(--color-text-primary); } markdown-style small { font-size: 90%; } markdown-style sub, markdown-style sup { font-size: 75%; line-height: 0; position: relative; vertical-align: baseline; } markdown-style sub { bottom: -0.25em; } markdown-style sup { top: -0.5em; } markdown-style img { border-style: none; max-width: 100%; box-sizing: content-box; background-color: var(--color-canvas-default); } markdown-style code, markdown-style kbd, markdown-style pre, markdown-style samp { font-family: monospace,monospace; font-size: 1em; } markdown-style figure { margin: 1em 40px; } markdown-style hr { box-sizing: content-box; overflow: hidden; background: transparent; border-bottom: 1px solid var(--color-border-muted); height: .25em; padding: 0; margin: 24px 0; background-color: var(--color-border-default); border: 0; } markdown-style input { font: inherit; margin: 0; overflow: visible; font-family: inherit; font-size: inherit; line-height: inherit; } markdown-style [type=button], markdown-style [type=reset], markdown-style [type=submit] { -webkit-appearance: button; } markdown-style [type=button]::-moz-focus-inner, markdown-style [type=reset]::-moz-focus-inner, markdown-style [type=submit]::-moz-focus-inner { border-style: none; padding: 0; } markdown-style [type=button]:-moz-focusring, markdown-style [type=reset]:-moz-focusring, markdown-style [type=submit]:-moz-focusring { outline: 1px dotted ButtonText; } markdown-style [type=checkbox], markdown-style [type=radio] { box-sizing: border-box; padding: 0; } markdown-style [type=number]::-webkit-inner-spin-button, markdown-style [type=number]::-webkit-outer-spin-button { height: auto; } markdown-style [type=search] { -webkit-appearance: textfield; outline-offset: -2px; } markdown-style [type=search]::-webkit-search-cancel-button, markdown-style [type=search]::-webkit-search-decoration { -webkit-appearance: none; } markdown-style ::-webkit-input-placeholder { color: inherit; opacity: .54; } markdown-style ::-webkit-file-upload-button { -webkit-appearance: button; font: inherit; } markdown-style a:hover { text-decoration: underline; } markdown-style hr::before { display: table; content: ""; } markdown-style hr::after { display: table; clear: both; content: ""; } markdown-style table { border-spacing: 0; border-collapse: collapse; display: block; width: max-content; max-width: 100%; overflow: auto; } markdown-style td, markdown-style th { padding: 0; } markdown-style details summary { cursor: pointer; } markdown-style details:not([open])>*:not(summary) { display: none !important; } markdown-style kbd { display: inline-block; padding: 3px 5px; font: 11px ui-monospace,SFMono-Regular,SF Mono,Menlo,Consolas,Liberation Mono,monospace; line-height: 10px; color: var(--color-fg-default); vertical-align: middle; background-color: var(--color-canvas-subtle); border: solid 1px var(--color-neutral-muted); border-bottom-color: var(--color-neutral-muted); border-radius: 6px; box-shadow: inset 0 -1px 0 var(--color-neutral-muted); } markdown-style h1, markdown-style h2, markdown-style h3, markdown-style h4, markdown-style h5, markdown-style h6 { margin-top: 24px; margin-bottom: 16px; font-weight: 600; line-height: 1.25; } markdown-style h2 { font-weight: 600; padding-bottom: .3em; font-size: 1.5em; border-bottom: 1px solid var(--color-border-muted); } markdown-style h3 { font-weight: 600; font-size: 1.25em; } markdown-style h4 { font-weight: 600; font-size: 1em; } markdown-style h5 { font-weight: 600; font-size: .875em; } markdown-style h6 { font-weight: 600; font-size: .85em; color: var(--color-fg-muted); } markdown-style p { margin-top: 0; margin-bottom: 10px; } markdown-style blockquote { margin: 0; padding: 0 1em; color: var(--color-fg-muted); border-left: .25em solid var(--color-border-default); } markdown-style ul, markdown-style ol { margin-top: 0; margin-bottom: 0; padding-left: 2em; } markdown-style ol ol, markdown-style ul ol { list-style-type: lower-roman; } markdown-style ul ul ol, markdown-style ul ol ol, markdown-style ol ul ol, markdown-style ol ol ol { list-style-type: lower-alpha; } markdown-style dd { margin-left: 0; } markdown-style tt, markdown-style code { font-family: ui-monospace,SFMono-Regular,SF Mono,Menlo,Consolas,Liberation Mono,monospace; font-size: 12px; } markdown-style pre { margin-top: 0; margin-bottom: 0; font-family: ui-monospace,SFMono-Regular,SF Mono,Menlo,Consolas,Liberation Mono,monospace; font-size: 12px; word-wrap: normal; } markdown-style .octicon { display: inline-block; overflow: visible !important; vertical-align: text-bottom; fill: currentColor; } markdown-style ::placeholder { color: var(--color-fg-subtle); opacity: 1; } markdown-style input::-webkit-outer-spin-button, markdown-style input::-webkit-inner-spin-button { margin: 0; -webkit-appearance: none; appearance: none; }
markdown-style .token.comment, markdown-style .token.prolog, markdown-style .token.doctype, markdown-style .token.cdata { color: var(--color-prettylights-syntax-comment); } markdown-style .token.namespace { opacity: 0.7; } markdown-style .token.tag, markdown-style .token.selector, markdown-style .token.constant, markdown-style .token.symbol, markdown-style .token.deleted { color: var(--color-prettylights-syntax-entity-tag); } markdown-style .token.maybe-class-name { color: var(--color-prettylights-syntax-variable); } markdown-style .token.property-access, markdown-style .token.operator, markdown-style .token.boolean, markdown-style .token.number, markdown-style .token.selector markdown-style .token.class, markdown-style .token.attr-name, markdown-style .token.string, markdown-style .token.char, markdown-style .token.builtin { color: var(--color-prettylights-syntax-constant); } markdown-style .token.deleted { color: var(--color-prettylights-syntax-markup-deleted-text); } markdown-style .token.property { color: var(--color-prettylights-syntax-constant); } markdown-style .token.punctuation { color: var(--color-prettylights-syntax-markup-bold); } markdown-style .token.function { color: var(--color-prettylights-syntax-entity); } markdown-style .code-line .token.deleted { background-color: var(--color-prettylights-syntax-markup-deleted-bg); } markdown-style .token.inserted { color: var(--color-prettylights-syntax-markup-inserted-text); } markdown-style .code-line .token.inserted { background-color: var(--color-prettylights-syntax-markup-inserted-bg); } markdown-style .token.variable { color: var(--color-prettylights-syntax-constant); } markdown-style .token.entity, markdown-style .token.url, .language-css markdown-style .token.string, .style markdown-style .token.string { color: var(--color-prettylights-syntax-string); } markdown-style .token.color, markdown-style .token.atrule, markdown-style .token.attr-value, markdown-style .token.function, markdown-style .token.class-name { color: var(--color-prettylights-syntax-string); } markdown-style .token.rule, markdown-style .token.regex, markdown-style .token.important, markdown-style .token.keyword { color: var(--color-prettylights-syntax-keyword); } markdown-style .token.coord { color: var(--color-prettylights-syntax-meta-diff-range); } markdown-style .token.important, markdown-style .token.bold { font-weight: bold; } markdown-style .token.italic { font-style: italic; } markdown-style .token.entity { cursor: help; }
markdown-style [data-catalyst] { display: block; } markdown-style g-emoji { font-family: "Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol"; font-size: 1em; font-style: normal !important; font-weight: 400; line-height: 1; vertical-align: -0.075em; } markdown-style g-emoji img { width: 1em; height: 1em; } markdown-style::before { display: table; content: ""; } markdown-style::after { display: table; clear: both; content: ""; } markdown-style>*:first-child { margin-top: 0 !important; } markdown-style>*:last-child { margin-bottom: 0 !important; } markdown-style a:not([href]) { color: inherit; text-decoration: none; } markdown-style .absent { color: var(--color-danger-fg); } markdown-style a.anchor { float: left; padding-right: 4px; margin-left: -20px; line-height: 1; } markdown-style a.anchor:focus { outline: none; } markdown-style p, markdown-style blockquote, markdown-style ul, markdown-style ol, markdown-style dl, markdown-style table, markdown-style pre, markdown-style details { margin-top: 0; margin-bottom: 16px; } markdown-style blockquote>:first-child { margin-top: 0; } markdown-style blockquote>:last-child { margin-bottom: 0; } markdown-style sup>a::before { content: "["; } markdown-style sup>a::after { content: "]"; }
markdown-style .octicon-video { border: 1px solid #d0d7de !important; border-radius: 6px !important; display: block; } markdown-style .octicon-video summary { border-bottom: 1px solid #d0d7de !important; padding: 8px 16px !important; cursor: pointer; } markdown-style .octicon-video > video { display: block !important; max-width: 100% !important; padding: 2px; box-sizing: border-box; border-bottom-right-radius: 6px !important; border-bottom-left-radius: 6px !important; } markdown-style details.octicon-video:not([open])>*:not(summary) { display: none !important; } markdown-style details.octicon-video:not([open]) > summary { border-bottom: 0 !important; } markdown-style h1 .octicon-link, markdown-style h2 .octicon-link, markdown-style h3 .octicon-link, markdown-style h4 .octicon-link, markdown-style h5 .octicon-link, markdown-style h6 .octicon-link { color: var(--color-fg-default); vertical-align: middle; visibility: hidden; } markdown-style h1:hover .anchor, markdown-style h2:hover .anchor, markdown-style h3:hover .anchor, markdown-style h4:hover .anchor, markdown-style h5:hover .anchor, markdown-style h6:hover .anchor { text-decoration: none; } markdown-style h1:hover .anchor .octicon-link, markdown-style h2:hover .anchor .octicon-link, markdown-style h3:hover .anchor .octicon-link, markdown-style h4:hover .anchor .octicon-link, markdown-style h5:hover .anchor .octicon-link, markdown-style h6:hover .anchor .octicon-link { visibility: visible; } markdown-style h1 tt, markdown-style h1 code, markdown-style h2 tt, markdown-style h2 code, markdown-style h3 tt, markdown-style h3 code, markdown-style h4 tt, markdown-style h4 code, markdown-style h5 tt, markdown-style h5 code, markdown-style h6 tt, markdown-style h6 code { padding: 0 .2em; font-size: inherit; } markdown-style ul.no-list, markdown-style ol.no-list { padding: 0; list-style-type: none; } markdown-style ol[type="1"] { list-style-type: decimal; } markdown-style ol[type=a] { list-style-type: lower-alpha; } markdown-style ol[type=i] { list-style-type: lower-roman; } markdown-style div>ol:not([type]) { list-style-type: decimal; } markdown-style ul ul, markdown-style ul ol, markdown-style ol ol, markdown-style ol ul { margin-top: 0; margin-bottom: 0; } markdown-style li>p { margin-top: 16px; } markdown-style li+li { margin-top: .25em; } markdown-style dl { padding: 0; } markdown-style dl dt { padding: 0; margin-top: 16px; font-size: 1em; font-style: italic; font-weight: 600; } markdown-style dl dd { padding: 0 16px; margin-bottom: 16px; } markdown-style table th { font-weight: 600; } markdown-style table th, markdown-style table td { padding: 6px 13px; border: 1px solid var(--color-border-default); } markdown-style table tr { background-color: var(--color-canvas-default); border-top: 1px solid var(--color-border-muted); } markdown-style table tr:nth-child(2n) { background-color: var(--color-canvas-subtle); } markdown-style table img { background-color: transparent; vertical-align: middle; } markdown-style img[align=right] { padding-left: 20px; } markdown-style img[align=left] { padding-right: 20px; } markdown-style .emoji { max-width: none; vertical-align: text-top; background-color: transparent; } markdown-style span.frame { display: block; overflow: hidden; } markdown-style span.frame>span { display: block; float: left; width: auto; padding: 7px; margin: 13px 0 0; overflow: hidden; border: 1px solid var(--color-border-default); } markdown-style span.frame span img { display: block; float: left; } markdown-style span.frame span span { display: block; padding: 5px 0 0; clear: both; color: var(--color-fg-default); } markdown-style span.align-center { display: block; overflow: hidden; clear: both; } markdown-style span.align-center>span { display: block; margin: 13px auto 0; overflow: hidden; text-align: center; } markdown-style span.align-center span img { margin: 0 auto; text-align: center; } markdown-style span.align-right { display: block; overflow: hidden; clear: both; } markdown-style span.align-right>span { display: block; margin: 13px 0 0; overflow: hidden; text-align: right; } markdown-style span.align-right span img { margin: 0; text-align: right; } markdown-style span.float-left { display: block; float: left; margin-right: 13px; overflow: hidden; } markdown-style span.float-left span { margin: 13px 0 0; } markdown-style span.float-right { display: block; float: right; margin-left: 13px; overflow: hidden; } markdown-style span.float-right>span { display: block; margin: 13px auto 0; overflow: hidden; text-align: right; } markdown-style code, markdown-style tt { padding: .2em .4em; margin: 0; font-size: 85%; background-color: var(--color-neutral-muted); border-radius: 6px; } markdown-style code br, markdown-style tt br { display: none; } markdown-style del code { text-decoration: inherit; } markdown-style pre code { font-size: 100%; } markdown-style pre>code { padding: 0; margin: 0; word-break: normal; white-space: pre; background: transparent; border: 0; } markdown-style pre { position: relative; font-size: 85%; line-height: 1.45; background-color: var(--color-canvas-subtle); border-radius: 6px; } markdown-style pre code, markdown-style pre tt { display: inline; max-width: auto; padding: 0; margin: 0; overflow: visible; line-height: inherit; word-wrap: normal; background-color: transparent; border: 0; } markdown-style pre > code { padding: 16px; overflow: auto; display: block; } markdown-style .csv-data td, markdown-style .csv-data th { padding: 5px; overflow: hidden; font-size: 12px; line-height: 1; text-align: left; white-space: nowrap; } markdown-style .csv-data .blob-num { padding: 10px 8px 9px; text-align: right; background: var(--color-canvas-default); border: 0; } markdown-style .csv-data tr { border-top: 0; } markdown-style .csv-data th { font-weight: 600; background: var(--color-canvas-subtle); border-top: 0; } markdown-style .footnotes { font-size: 12px; color: var(--color-fg-muted); border-top: 1px solid var(--color-border-default); } markdown-style .footnotes ol { padding-left: 16px; } markdown-style .footnotes li { position: relative; } markdown-style .footnotes li:target::before { position: absolute; top: -8px; right: -8px; bottom: -8px; left: -24px; pointer-events: none; content: ""; border: 2px solid var(--color-accent-emphasis); border-radius: 6px; } markdown-style .footnotes li:target { color: var(--color-fg-default); } markdown-style .footnotes .data-footnote-backref g-emoji { font-family: monospace; } markdown-style .task-list-item { list-style-type: none; } markdown-style .task-list-item label { font-weight: 400; } markdown-style .task-list-item.enabled label { cursor: pointer; } markdown-style .task-list-item+.task-list-item { margin-top: 3px; } markdown-style .task-list-item .handle { display: none; } markdown-style .task-list-item-checkbox, markdown-style input[type="checkbox"] { margin: 0 .2em .25em -1.6em; vertical-align: middle; } markdown-style .contains-task-list:dir(rtl) .task-list-item-checkbox, markdown-style .contains-task-list:dir(rtl) input[type="checkbox"] { margin: 0 -1.6em .25em .2em; } markdown-style ::-webkit-calendar-picker-indicator { filter: invert(50%); }
</style>
<slot></slot>
`;
class MarkdownStyle extends HTMLElement {
    constructor() {
        super();
        this.shadow = this.attachShadow({ mode: 'open' });
        this.shadow.appendChild(__TEMPLATE__.content.cloneNode(true));
        const style = Array.prototype.slice
            .call(this.shadow.children)
            .find((item) => item.tagName === 'STYLE');
        if (style) {
            const id = '__MARKDOWN_STYLE__';
            const findStyle = document.getElementById(id);
            if (!findStyle) {
                style.id = id;
                document.head.append(style);
            }
        }
    }
    get theme() {
        const value = this.getAttribute('theme');
        return value === null ? '' : value;
    }
    set theme(name) {
        this.setAttribute('theme', name);
    }
    connectedCallback() {
        if (!this.theme) {
            const { colorMode } = document.documentElement.dataset;
            this.theme = colorMode;
            const observer = new MutationObserver((mutationsList, observer) => {
                this.theme = document.documentElement.dataset.colorMode;
            });
            observer.observe(document.documentElement, { attributes: true });
            window.matchMedia('(prefers-color-scheme: light)').onchange = (event) => {
                this.theme = event.matches ? 'light' : 'dark';
            };
            window.matchMedia('(prefers-color-scheme: dark)').onchange = (event) => {
                this.theme = event.matches ? 'dark' : 'light';
            };
        }
    }
}
customElements.define('markdown-style', MarkdownStyle);</script><markdown-style style="max-width: 960px; margin: 0 auto 60px auto; padding: 8px" class="markdown-style">
<h1 id="tar"><a class="anchor" aria-hidden="true" tabindex="-1" href="#tar"><span class="octicon octicon-link"></span></a>tar</h1>
<p>将许多文件一起保存至一个单独的磁带或磁盘归档，并能从归档中单独还原所需文件。</p>
<h2 id="补充说明"><a class="anchor" aria-hidden="true" tabindex="-1" href="#补充说明"><span class="octicon octicon-link"></span></a>补充说明</h2>
<p><strong>tar命令</strong> 可以为linux的文件和目录创建档案。利用tar，可以为某一特定文件创建档案（备份文件），也可以在档案中改变文件，或者向档案中加入新的文件。tar最初被用来在磁带上创建档案，现在，用户可以在任何设备上创建档案。利用tar命令，可以把一大堆的文件和目录全部打包成一个文件，这对于备份文件或将几个文件组合成为一个文件以便于网络传输是非常有用的。</p>
<p>首先要弄清两个概念：打包和压缩。打包是指将一大堆文件或目录变成一个总的文件；压缩则是将一个大的文件通过一些压缩算法变成一个小文件。</p>
<p>为什么要区分这两个概念呢？这源于Linux中很多压缩程序只能针对一个文件进行压缩，这样当你想要压缩一大堆文件时，你得先将这一大堆文件先打成一个包（tar命令），然后再用压缩程序进行压缩（gzip bzip2命令）。</p>
<h3 id="语法"><a class="anchor" aria-hidden="true" tabindex="-1" href="#语法"><span class="octicon octicon-link"></span></a>语法</h3>
<pre class="language-shell"><code class="language-shell code-highlight"><span class="code-line line-number" line="1"><span class="token function">tar</span> <span class="token punctuation">[</span>选项<span class="token punctuation">..</span>.<span class="token punctuation">]</span> <span class="token punctuation">[</span>FILE<span class="token punctuation">]</span><span class="token punctuation">..</span>.
</span></code><div onclick="copied(this)" data-code="tar [选项...] [FILE]...
" class="copied"><svg class="octicon-copy" aria-hidden="true" viewBox="0 0 16 16" fill="currentColor" height="12" width="12"><path fill-rule="evenodd" d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 010 1.5h-1.5a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-1.5a.75.75 0 011.5 0v1.5A1.75 1.75 0 019.25 16h-7.5A1.75 1.75 0 010 14.25v-7.5z"></path><path fill-rule="evenodd" d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0114.25 11h-7.5A1.75 1.75 0 015 9.25v-7.5zm1.75-.25a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-7.5a.25.25 0 00-.25-.25h-7.5z"></path></svg><svg class="octicon-check" aria-hidden="true" viewBox="0 0 16 16" fill="currentColor" height="12" width="12"><path fill-rule="evenodd" d="M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.06 0z"></path></svg></div></pre>
<h3 id="选项"><a class="anchor" aria-hidden="true" tabindex="-1" href="#选项"><span class="octicon octicon-link"></span></a>选项</h3>
<pre class="language-shell"><code class="language-shell code-highlight"><span class="code-line line-number" line="1">-A, --catenate, <span class="token parameter variable">--concatenate</span>   追加 <span class="token function">tar</span> 文件至归档
</span><span class="code-line line-number" line="2">-c, <span class="token parameter variable">--create</span>               创建一个新归档
</span><span class="code-line line-number" line="3">-d, --diff, <span class="token parameter variable">--compare</span>      找出归档和文件系统的差异
</span><span class="code-line line-number" line="4">    <span class="token parameter variable">--delete</span>               从归档<span class="token punctuation">(</span>非磁带！<span class="token punctuation">)</span>中删除
</span><span class="code-line line-number" line="5">-r, <span class="token parameter variable">--append</span>               追加文件至归档结尾
</span><span class="code-line line-number" line="6">-t, <span class="token parameter variable">--list</span>                 列出归档内容
</span><span class="code-line line-number" line="7">    --test-label           测试归档卷标并退出
</span><span class="code-line line-number" line="8">-u, <span class="token parameter variable">--update</span>               仅追加比归档中副本更新的文件
</span><span class="code-line line-number" line="9">-x, --extract, <span class="token parameter variable">--get</span>       从归档中解出文件
</span><span class="code-line line-number" line="10">
</span><span class="code-line line-number" line="11">操作修饰符:
</span><span class="code-line line-number" line="12">
</span><span class="code-line line-number" line="13">      --check-device         当创建增量归档时检查设备号<span class="token punctuation">(</span>默认<span class="token punctuation">)</span>
</span><span class="code-line line-number" line="14">  -g, --listed-incremental<span class="token operator">=</span>FILE   处理新式的 GNU 格式的增量备份
</span><span class="code-line line-number" line="15">  -G, <span class="token parameter variable">--incremental</span>          处理老式的 GNU 格式的增量备份
</span><span class="code-line line-number" line="16">      --ignore-failed-read
</span><span class="code-line line-number" line="17">                             当遇上不可读文件时不要以非零值退出
</span><span class="code-line line-number" line="18">      <span class="token parameter variable">--level</span><span class="token operator">=</span>NUMBER         所创建的增量列表归档的输出级别
</span><span class="code-line line-number" line="19">  -n, <span class="token parameter variable">--seek</span>                 归档可检索
</span><span class="code-line line-number" line="20">      --no-check-device      当创建增量归档时不要检查设备号
</span><span class="code-line line-number" line="21">      --no-seek              归档不可检索
</span><span class="code-line line-number" line="22">      --occurrence<span class="token punctuation">[</span><span class="token operator">=</span>NUMBER<span class="token punctuation">]</span>  仅处理归档中每个文件的第 NUMBER
</span><span class="code-line line-number" line="23">                             个事件；仅当与以下子命令 --delete,
</span><span class="code-line line-number" line="24">                             --diff, <span class="token parameter variable">--extract</span> 或是 <span class="token parameter variable">--list</span>
</span><span class="code-line line-number" line="25">                             中的一个联合使用时，此选项才有效。而且不管文件列表是以命令行形式给出或是通过
</span><span class="code-line line-number" line="26">                             <span class="token parameter variable">-T</span> 选项指定的；NUMBER 值默认为 <span class="token number">1</span>
</span><span class="code-line line-number" line="27">      --sparse-version<span class="token operator">=</span>MAJOR<span class="token punctuation">[</span>.MINOR<span class="token punctuation">]</span>
</span><span class="code-line line-number" line="28">                             设置所用的离散格式版本<span class="token punctuation">(</span>隐含
</span><span class="code-line line-number" line="29">                             --sparse<span class="token punctuation">)</span>
</span><span class="code-line line-number" line="30">  -S, <span class="token parameter variable">--sparse</span>               高效处理离散文件
</span><span class="code-line line-number" line="31">
</span><span class="code-line line-number" line="32"> 重写控制:
</span><span class="code-line line-number" line="33">
</span><span class="code-line line-number" line="34">  -k, --keep-old-files       don<span class="token string">'t replace existing files when extracting,
</span></span><span class="code-line line-number" line="35"><span class="token string">                             treat them as errors
</span></span><span class="code-line line-number" line="36"><span class="token string">      --keep-directory-symlink   preserve existing symlinks to directories when
</span></span><span class="code-line line-number" line="37"><span class="token string">                             extracting
</span></span><span class="code-line line-number" line="38"><span class="token string">      --keep-newer-files
</span></span><span class="code-line line-number" line="39"><span class="token string">                             不要替换比归档中副本更新的已存在的文件
</span></span><span class="code-line line-number" line="40"><span class="token string">      --no-overwrite-dir     保留已存在目录的元数据
</span></span><span class="code-line line-number" line="41"><span class="token string">      --overwrite            解压时重写存在的文件
</span></span><span class="code-line line-number" line="42"><span class="token string">      --overwrite-dir        解压时重写已存在目录的元数据(默认)
</span></span><span class="code-line line-number" line="43"><span class="token string">
</span></span><span class="code-line line-number" line="44"><span class="token string">      --recursive-unlink     解压目录之前先清除目录层次
</span></span><span class="code-line line-number" line="45"><span class="token string">      --remove-files         在添加文件至归档后删除它们
</span></span><span class="code-line line-number" line="46"><span class="token string">      --skip-old-files       don'</span>t replace existing files when extracting,
</span><span class="code-line line-number" line="47">                             silently skip over them
</span><span class="code-line line-number" line="48">  -U, --unlink-first         在解压要重写的文件之前先删除它们
</span><span class="code-line line-number" line="49">  -W, <span class="token parameter variable">--verify</span>               在写入以后尝试校验归档
</span><span class="code-line line-number" line="50">
</span><span class="code-line line-number" line="51"> 选择输出流:
</span><span class="code-line line-number" line="52">
</span><span class="code-line line-number" line="53">      --ignore-command-error 忽略子进程的退出代码
</span><span class="code-line line-number" line="54">      --no-ignore-command-error
</span><span class="code-line line-number" line="55">                             将子进程的非零退出代码认为发生错误
</span><span class="code-line line-number" line="56">  -O, --to-stdout            解压文件至标准输出
</span><span class="code-line line-number" line="57">      --to-command<span class="token operator">=</span>COMMAND
</span><span class="code-line line-number" line="58">                             将解压的文件通过管道传送至另一个程序
</span><span class="code-line line-number" line="59">
</span><span class="code-line line-number" line="60"> 操作文件属性:
</span><span class="code-line line-number" line="61">
</span><span class="code-line line-number" line="62">      --atime-preserve<span class="token punctuation">[</span><span class="token operator">=</span>METHOD<span class="token punctuation">]</span>
</span><span class="code-line line-number" line="63">                             在输出的文件上保留访问时间，要么通过在读取<span class="token punctuation">(</span>默认
</span><span class="code-line line-number" line="64">                             <span class="token assign-left variable">METHOD</span><span class="token operator">=</span>‘replace’<span class="token punctuation">)</span>后还原时间，要不就不要在第一次<span class="token punctuation">(</span>METHOD<span class="token operator">=</span>‘system’<span class="token punctuation">)</span>设置时间
</span><span class="code-line line-number" line="65">      --delay-directory-restore
</span><span class="code-line line-number" line="66">                             直到解压结束才设置修改时间和所解目录的权限
</span><span class="code-line line-number" line="67">      <span class="token parameter variable">--group</span><span class="token operator">=</span>名称         强制将 NAME
</span><span class="code-line line-number" line="68">                             作为所添加的文件的组所有者
</span><span class="code-line line-number" line="69">      <span class="token parameter variable">--mode</span><span class="token operator">=</span>CHANGES         强制将所添加的文件<span class="token punctuation">(</span>符号<span class="token punctuation">)</span>更改为权限
</span><span class="code-line line-number" line="70">                             CHANGES
</span><span class="code-line line-number" line="71">      <span class="token parameter variable">--mtime</span><span class="token operator">=</span>DATE-OR-FILE   从 DATE-OR-FILE 中为添加的文件设置
</span><span class="code-line line-number" line="72">                             mtime
</span><span class="code-line line-number" line="73">  -m, <span class="token parameter variable">--touch</span>                不要解压文件的修改时间
</span><span class="code-line line-number" line="74">      --no-delay-directory-restore
</span><span class="code-line line-number" line="75">                             取消 --delay-directory-restore 选项的效果
</span><span class="code-line line-number" line="76">      --no-same-owner
</span><span class="code-line line-number" line="77">                             将文件解压为您所有<span class="token punctuation">(</span>普通用户默认此项<span class="token punctuation">)</span>
</span><span class="code-line line-number" line="78">      --no-same-permissions
</span><span class="code-line line-number" line="79">                             从归档中解压权限时使用用户的掩码位<span class="token punctuation">(</span>默认为普通用户服务<span class="token punctuation">)</span>
</span><span class="code-line line-number" line="80">      --numeric-owner        总是以数字代表用户/组的名称
</span><span class="code-line line-number" line="81">      <span class="token parameter variable">--owner</span><span class="token operator">=</span>名称         强制将 NAME
</span><span class="code-line line-number" line="82">                             作为所添加的文件的所有者
</span><span class="code-line line-number" line="83">  -p, --preserve-permissions, --same-permissions
</span><span class="code-line line-number" line="84">                             解压文件权限信息<span class="token punctuation">(</span>默认只为超级用户服务<span class="token punctuation">)</span>
</span><span class="code-line line-number" line="85">      <span class="token parameter variable">--preserve</span>             与 <span class="token parameter variable">-p</span> 和 <span class="token parameter variable">-s</span> 一样
</span><span class="code-line line-number" line="86">      --same-owner
</span><span class="code-line line-number" line="87">                             尝试解压时保持所有者关系一致<span class="token punctuation">(</span>超级用户默认此项<span class="token punctuation">)</span>
</span><span class="code-line line-number" line="88">  -s, --preserve-order, --same-order
</span><span class="code-line line-number" line="89">                             member arguments are listed <span class="token keyword">in</span> the same order as
</span><span class="code-line line-number" line="90">                             the files <span class="token keyword">in</span> the archive
</span><span class="code-line line-number" line="91">
</span><span class="code-line line-number" line="92"> Handling of extended <span class="token function">file</span> attributes:
</span><span class="code-line line-number" line="93">
</span><span class="code-line line-number" line="94">      <span class="token parameter variable">--acls</span>                 Enable the POSIX ACLs support
</span><span class="code-line line-number" line="95">      --no-acls              Disable the POSIX ACLs support
</span><span class="code-line line-number" line="96">      --no-selinux           Disable the SELinux context support
</span><span class="code-line line-number" line="97">      --no-xattrs            Disable extended attributes support
</span><span class="code-line line-number" line="98">      <span class="token parameter variable">--selinux</span>              Enable the SELinux context support
</span><span class="code-line line-number" line="99">      <span class="token parameter variable">--xattrs</span>               Enable extended attributes support
</span><span class="code-line line-number" line="100">      --xattrs-exclude<span class="token operator">=</span>MASK  specify the exclude pattern <span class="token keyword">for</span> xattr keys
</span><span class="code-line line-number" line="101">      --xattrs-include<span class="token operator">=</span>MASK  specify the include pattern <span class="token keyword">for</span> xattr keys
</span><span class="code-line line-number" line="102">
</span><span class="code-line line-number" line="103"> 设备选择和切换:
</span><span class="code-line line-number" line="104">
</span><span class="code-line line-number" line="105">  -f, <span class="token parameter variable">--file</span><span class="token operator">=</span>ARCHIVE         使用归档文件或 ARCHIVE 设备
</span><span class="code-line line-number" line="106">      --force-local
</span><span class="code-line line-number" line="107">                             即使归档文件存在副本还是把它认为是本地归档
</span><span class="code-line line-number" line="108">  -F, --info-script<span class="token operator">=</span>名称, --new-volume-script<span class="token operator">=</span>名称
</span><span class="code-line line-number" line="109">                             在每卷磁带最后运行脚本<span class="token punctuation">(</span>隐含 -M<span class="token punctuation">)</span>
</span><span class="code-line line-number" line="110">  -L, --tape-length<span class="token operator">=</span>NUMBER   写入 NUMBER × <span class="token number">1024</span> 字节后更换磁带
</span><span class="code-line line-number" line="111">  -M, --multi-volume         创建/列出/解压多卷归档文件
</span><span class="code-line line-number" line="112">      --rmt-command<span class="token operator">=</span>COMMAND  使用指定的 rmt COMMAND 代替 rmt
</span><span class="code-line line-number" line="113">      --rsh-command<span class="token operator">=</span>COMMAND  使用远程 COMMAND 代替 rsh
</span><span class="code-line line-number" line="114">      --volno-file<span class="token operator">=</span>FILE      使用/更新 FILE 中的卷数
</span><span class="code-line line-number" line="115">
</span><span class="code-line line-number" line="116"> 设备分块:
</span><span class="code-line line-number" line="117">
</span><span class="code-line line-number" line="118">  -b, --blocking-factor<span class="token operator">=</span>BLOCKS   每个记录 BLOCKS x <span class="token number">512</span> 字节
</span><span class="code-line line-number" line="119">  -B, --read-full-records    读取时重新分块<span class="token punctuation">(</span>只对 <span class="token number">4</span>.2BSD 管道有效<span class="token punctuation">)</span>
</span><span class="code-line line-number" line="120">  -i, --ignore-zeros         忽略归档中的零字节块<span class="token punctuation">(</span>即文件结尾<span class="token punctuation">)</span>
</span><span class="code-line line-number" line="121">      --record-size<span class="token operator">=</span>NUMBER   每个记录的字节数 NUMBER，乘以 <span class="token number">512</span>
</span><span class="code-line line-number" line="122">
</span><span class="code-line line-number" line="123"> 选择归档格式:
</span><span class="code-line line-number" line="124">
</span><span class="code-line line-number" line="125">  -H, <span class="token parameter variable">--format</span><span class="token operator">=</span>FORMAT        创建指定格式的归档
</span><span class="code-line line-number" line="126">
</span><span class="code-line line-number" line="127"> FORMAT 是以下格式中的一种:
</span><span class="code-line line-number" line="128">
</span><span class="code-line line-number" line="129">    gnu                      GNU <span class="token function">tar</span> <span class="token number">1.13</span>.x 格式
</span><span class="code-line line-number" line="130">    oldgnu                   GNU 格式 as per <span class="token function">tar</span> <span class="token operator">&#x3C;=</span> <span class="token number">1.12</span>
</span><span class="code-line line-number" line="131">    pax                      POSIX <span class="token number">1003.1</span>-2001 <span class="token punctuation">(</span>pax<span class="token punctuation">)</span> 格式
</span><span class="code-line line-number" line="132">    posix                    等同于 pax
</span><span class="code-line line-number" line="133">    ustar                    POSIX <span class="token number">1003.1</span>-1988 <span class="token punctuation">(</span>ustar<span class="token punctuation">)</span> 格式
</span><span class="code-line line-number" line="134">    v7                       old V7 <span class="token function">tar</span> 格式
</span><span class="code-line line-number" line="135">
</span><span class="code-line line-number" line="136">      --old-archive, <span class="token parameter variable">--portability</span>
</span><span class="code-line line-number" line="137">                             等同于 <span class="token parameter variable">--format</span><span class="token operator">=</span>v7
</span><span class="code-line line-number" line="138">      --pax-option<span class="token operator">=</span>关键字<span class="token punctuation">[</span><span class="token punctuation">[</span>:<span class="token punctuation">]</span><span class="token operator">=</span>值<span class="token punctuation">]</span><span class="token punctuation">[</span>,关键字<span class="token punctuation">[</span><span class="token punctuation">[</span>:<span class="token punctuation">]</span><span class="token operator">=</span>值<span class="token punctuation">]</span><span class="token punctuation">]</span><span class="token punctuation">..</span>.
</span><span class="code-line line-number" line="139">                             控制 pax 关键字
</span><span class="code-line line-number" line="140">      <span class="token parameter variable">--posix</span>                等同于 <span class="token parameter variable">--format</span><span class="token operator">=</span>posix
</span><span class="code-line line-number" line="141">  -V, <span class="token parameter variable">--label</span><span class="token operator">=</span>TEXT           创建带有卷名 TEXT
</span><span class="code-line line-number" line="142">                             的归档；在列出/解压时，使用 TEXT
</span><span class="code-line line-number" line="143">                             作为卷名的模式串
</span><span class="code-line line-number" line="144">
</span><span class="code-line line-number" line="145"> 压缩选项:
</span><span class="code-line line-number" line="146">
</span><span class="code-line line-number" line="147">  -a, --auto-compress        使用归档后缀名来决定压缩程序
</span><span class="code-line line-number" line="148">  -I, --use-compress-program<span class="token operator">=</span>PROG
</span><span class="code-line line-number" line="149">                             通过 PROG 过滤<span class="token punctuation">(</span>必须是能接受 <span class="token parameter variable">-d</span>
</span><span class="code-line line-number" line="150">                             选项的程序<span class="token punctuation">)</span>
</span><span class="code-line line-number" line="151">  -j, <span class="token parameter variable">--bzip2</span>                通过 <span class="token function">bzip2</span> 过滤归档
</span><span class="code-line line-number" line="152">  -J, <span class="token parameter variable">--xz</span>                   通过 xz 过滤归档
</span><span class="code-line line-number" line="153">      <span class="token parameter variable">--lzip</span>                 通过 lzip 过滤归档
</span><span class="code-line line-number" line="154">      <span class="token parameter variable">--lzma</span>                 通过 lzma 过滤归档
</span><span class="code-line line-number" line="155">      <span class="token parameter variable">--lzop</span>
</span><span class="code-line line-number" line="156">      --no-auto-compress     不使用归档后缀名来决定压缩程序
</span><span class="code-line line-number" line="157">  -z, --gzip, --gunzip, <span class="token parameter variable">--ungzip</span>   通过 <span class="token function">gzip</span> 过滤归档
</span><span class="code-line line-number" line="158">  -Z, --compress, <span class="token parameter variable">--uncompress</span>   通过 compress 过滤归档
</span><span class="code-line line-number" line="159">
</span><span class="code-line line-number" line="160"> 本地文件选择:
</span><span class="code-line line-number" line="161">
</span><span class="code-line line-number" line="162">      --add-file<span class="token operator">=</span>FILE        添加指定的 FILE 至归档<span class="token punctuation">(</span>如果名字以 -
</span><span class="code-line line-number" line="163">                             开始会很有用的<span class="token punctuation">)</span>
</span><span class="code-line line-number" line="164">      --backup<span class="token punctuation">[</span><span class="token operator">=</span>CONTROL<span class="token punctuation">]</span>     在删除前备份，选择 CONTROL 版本
</span><span class="code-line line-number" line="165">  -C, <span class="token parameter variable">--directory</span><span class="token operator">=</span>DIR        改变至目录 DIR
</span><span class="code-line line-number" line="166">      <span class="token parameter variable">--exclude</span><span class="token operator">=</span>PATTERN      排除以 PATTERN 指定的文件
</span><span class="code-line line-number" line="167">      --exclude-backups      排除备份和锁文件
</span><span class="code-line line-number" line="168">      --exclude-caches       除标识文件本身外，排除包含
</span><span class="code-line line-number" line="169">                             CACHEDIR.TAG 的目录中的内容
</span><span class="code-line line-number" line="170">      --exclude-caches-all   排除包含 CACHEDIR.TAG 的目录
</span><span class="code-line line-number" line="171">      --exclude-caches-under 排除包含 CACHEDIR.TAG 的目录中所有内容
</span><span class="code-line line-number" line="172">
</span><span class="code-line line-number" line="173">      --exclude-tag<span class="token operator">=</span>FILE     除 FILE 自身外，排除包含 FILE
</span><span class="code-line line-number" line="174">                             的目录中的内容
</span><span class="code-line line-number" line="175">      --exclude-tag-all<span class="token operator">=</span>FILE 排除包含 FILE 的目录
</span><span class="code-line line-number" line="176">      --exclude-tag-under<span class="token operator">=</span>FILE   排除包含 FILE 的目录中的所有内容
</span><span class="code-line line-number" line="177">      --exclude-vcs          排除版本控制系统目录
</span><span class="code-line line-number" line="178">  -h, <span class="token parameter variable">--dereference</span>
</span><span class="code-line line-number" line="179">                             跟踪符号链接；将它们所指向的文件归档并输出
</span><span class="code-line line-number" line="180">      --hard-dereference
</span><span class="code-line line-number" line="181">                             跟踪硬链接；将它们所指向的文件归档并输出
</span><span class="code-line line-number" line="182">  -K, --starting-file<span class="token operator">=</span>MEMBER-NAME
</span><span class="code-line line-number" line="183">                             begin at member MEMBER-NAME when reading the
</span><span class="code-line line-number" line="184">                             archive
</span><span class="code-line line-number" line="185">      --newer-mtime<span class="token operator">=</span>DATE     当只有数据改变时比较数据和时间
</span><span class="code-line line-number" line="186">      --no-null              禁用上一次的效果 <span class="token parameter variable">--null</span> 选项
</span><span class="code-line line-number" line="187">      --no-recursion         避免目录中的自动降级
</span><span class="code-line line-number" line="188">      --no-unquote           不以 <span class="token parameter variable">-T</span> 读取的文件名作为引用结束
</span><span class="code-line line-number" line="189">      <span class="token parameter variable">--null</span>                 <span class="token parameter variable">-T</span> 读取以空终止的名字，-C 禁用
</span><span class="code-line line-number" line="190">  -N, <span class="token parameter variable">--newer</span><span class="token operator">=</span>DATE-OR-FILE, --after-date<span class="token operator">=</span>DATE-OR-FILE
</span><span class="code-line line-number" line="191">                             只保存比 DATE-OR-FILE 更新的文件
</span><span class="code-line line-number" line="192">      --one-file-system      创建归档时保存在本地文件系统中
</span><span class="code-line line-number" line="193">  -P, --absolute-names       不要从文件名中清除引导符‘/’
</span><span class="code-line line-number" line="194">      <span class="token parameter variable">--recursion</span>            目录递归<span class="token punctuation">(</span>默认<span class="token punctuation">)</span>
</span><span class="code-line line-number" line="195">      <span class="token parameter variable">--suffix</span><span class="token operator">=</span>STRING        在删除前备份，除非被环境变量
</span><span class="code-line line-number" line="196">                             SIMPLE_BACKUP_SUFFIX
</span><span class="code-line line-number" line="197">                             覆盖，否则覆盖常用后缀<span class="token punctuation">(</span>‘’<span class="token punctuation">)</span>
</span><span class="code-line line-number" line="198">  -T, --files-from<span class="token operator">=</span>FILE      从 FILE
</span><span class="code-line line-number" line="199">                             中获取文件名来解压或创建文件
</span><span class="code-line line-number" line="200">      <span class="token parameter variable">--unquote</span>              以 <span class="token parameter variable">-T</span>
</span><span class="code-line line-number" line="201">                             读取的文件名作为引用结束<span class="token punctuation">(</span>默认<span class="token punctuation">)</span>
</span><span class="code-line line-number" line="202">  -X, --exclude-from<span class="token operator">=</span>FILE    排除 FILE 中列出的模式串
</span><span class="code-line line-number" line="203">
</span><span class="code-line line-number" line="204"> 文件名变换:
</span><span class="code-line line-number" line="205">
</span><span class="code-line line-number" line="206">      --strip-components<span class="token operator">=</span>NUMBER   解压时从文件名中清除 NUMBER
</span><span class="code-line line-number" line="207">                             个引导部分
</span><span class="code-line line-number" line="208">      <span class="token parameter variable">--transform</span><span class="token operator">=</span>EXPRESSION, <span class="token parameter variable">--xform</span><span class="token operator">=</span>EXPRESSION
</span><span class="code-line line-number" line="209">                             使用 <span class="token function">sed</span> 代替 EXPRESSION
</span><span class="code-line line-number" line="210">                             来进行文件名变换
</span><span class="code-line line-number" line="211">
</span><span class="code-line line-number" line="212"> 文件名匹配选项<span class="token punctuation">(</span>同时影响排除和包括模式串<span class="token punctuation">)</span>:
</span><span class="code-line line-number" line="213">
</span><span class="code-line line-number" line="214">      <span class="token parameter variable">--anchored</span>             模式串匹配文件名头部
</span><span class="code-line line-number" line="215">      --ignore-case          忽略大小写
</span><span class="code-line line-number" line="216">      --no-anchored          模式串匹配任意‘/’后字符<span class="token punctuation">(</span>默认对
</span><span class="code-line line-number" line="217">                             exclusion 有效<span class="token punctuation">)</span>
</span><span class="code-line line-number" line="218">      --no-ignore-case       匹配大小写<span class="token punctuation">(</span>默认<span class="token punctuation">)</span>
</span><span class="code-line line-number" line="219">      --no-wildcards         逐字匹配字符串
</span><span class="code-line line-number" line="220">      --no-wildcards-match-slash   通配符不匹配‘/’
</span><span class="code-line line-number" line="221">      <span class="token parameter variable">--wildcards</span>            use wildcards <span class="token punctuation">(</span>default<span class="token punctuation">)</span>
</span><span class="code-line line-number" line="222">      --wildcards-match-slash
</span><span class="code-line line-number" line="223">                             通配符匹配‘/’<span class="token punctuation">(</span>默认对排除操作有效<span class="token punctuation">)</span>
</span><span class="code-line line-number" line="224">
</span><span class="code-line line-number" line="225"> 提示性输出:
</span><span class="code-line line-number" line="226">
</span><span class="code-line line-number" line="227">      --checkpoint<span class="token punctuation">[</span><span class="token operator">=</span>NUMBER<span class="token punctuation">]</span>  每隔 NUMBER
</span><span class="code-line line-number" line="228">                             个记录显示进度信息<span class="token punctuation">(</span>默认为 <span class="token number">10</span> 个<span class="token punctuation">)</span>
</span><span class="code-line line-number" line="229">      --checkpoint-action<span class="token operator">=</span>ACTION   在每个检查点上执行 ACTION
</span><span class="code-line line-number" line="230">      --full-time            print <span class="token function">file</span> <span class="token function">time</span> to its full resolution
</span><span class="code-line line-number" line="231">      --index-file<span class="token operator">=</span>FILE      将详细输出发送至 FILE
</span><span class="code-line line-number" line="232">  -l, --check-links
</span><span class="code-line line-number" line="233">                             只要不是所有链接都被输出就打印信息
</span><span class="code-line line-number" line="234">      --no-quote-chars<span class="token operator">=</span>STRING   禁用来自 STRING 的字符引用
</span><span class="code-line line-number" line="235">      --quote-chars<span class="token operator">=</span>STRING   来自 STRING 的额外的引用字符
</span><span class="code-line line-number" line="236">      --quoting-style<span class="token operator">=</span>STYLE  设置名称引用风格；有效的 STYLE
</span><span class="code-line line-number" line="237">                             值请参阅以下说明
</span><span class="code-line line-number" line="238">  -R, --block-number         每个信息都显示归档内的块数
</span><span class="code-line line-number" line="239">      --show-defaults        显示 <span class="token function">tar</span> 默认选项
</span><span class="code-line line-number" line="240">      --show-omitted-dirs
</span><span class="code-line line-number" line="241">                             列表或解压时，列出每个不匹配查找标准的目录
</span><span class="code-line line-number" line="242">      --show-transformed-names, --show-stored-names
</span><span class="code-line line-number" line="243">                             显示变换后的文件名或归档名
</span><span class="code-line line-number" line="244">      --totals<span class="token punctuation">[</span><span class="token operator">=</span>SIGNAL<span class="token punctuation">]</span>      处理归档后打印出总字节数；当此
</span><span class="code-line line-number" line="245">                             SIGNAL 被触发时带参数 -
</span><span class="code-line line-number" line="246">                             打印总字节数；允许的信号为:
</span><span class="code-line line-number" line="247">                             SIGHUP，SIGQUIT，SIGINT，SIGUSR1 和
</span><span class="code-line line-number" line="248">                             SIGUSR2；同时也接受不带 SIG
</span><span class="code-line line-number" line="249">                             前缀的信号名称
</span><span class="code-line line-number" line="250">      <span class="token parameter variable">--utc</span>                  以 UTC 格式打印文件修改时间
</span><span class="code-line line-number" line="251">  -v, <span class="token parameter variable">--verbose</span>              详细地列出处理的文件
</span><span class="code-line line-number" line="252">      <span class="token parameter variable">--warning</span><span class="token operator">=</span>KEYWORD      警告控制:
</span><span class="code-line line-number" line="253">  -w, --interactive, <span class="token parameter variable">--confirmation</span>
</span><span class="code-line line-number" line="254">                             每次操作都要求确认
</span><span class="code-line line-number" line="255">
</span><span class="code-line line-number" line="256"> 兼容性选项:
</span><span class="code-line line-number" line="257">
</span><span class="code-line line-number" line="258">  <span class="token parameter variable">-o</span>                         创建归档时，相当于
</span><span class="code-line line-number" line="259">                             --old-archive；展开归档时，相当于
</span><span class="code-line line-number" line="260">                             --no-same-owner
</span><span class="code-line line-number" line="261">
</span><span class="code-line line-number" line="262"> 其它选项:
</span><span class="code-line line-number" line="263">
</span><span class="code-line line-number" line="264">  -?, <span class="token parameter variable">--help</span>                 显示此帮助列表
</span><span class="code-line line-number" line="265">      <span class="token parameter variable">--restrict</span>             禁用某些潜在的有危险的选项
</span><span class="code-line line-number" line="266">      <span class="token parameter variable">--usage</span>                显示简短的用法说明
</span><span class="code-line line-number" line="267">      <span class="token parameter variable">--version</span>              打印程序版本
</span><span class="code-line line-number" line="268">
</span><span class="code-line line-number" line="269">长选项和相应短选项具有相同的强制参数或可选参数。
</span><span class="code-line line-number" line="270">
</span><span class="code-line line-number" line="271">除非以 <span class="token parameter variable">--suffix</span> 或 SIMPLE_BACKUP_SUFFIX
</span><span class="code-line line-number" line="272">设置备份后缀，否则备份后缀就是“~”。
</span><span class="code-line line-number" line="273">可以用 <span class="token parameter variable">--backup</span> 或 VERSION_CONTROL 设置版本控制，可能的值为：
</span><span class="code-line line-number" line="274">
</span><span class="code-line line-number" line="275">  none, off	   从不做备份
</span><span class="code-line line-number" line="276">  t, numbered     进行编号备份
</span><span class="code-line line-number" line="277">  nil, existing
</span><span class="code-line line-number" line="278">如果编号备份存在则进行编号备份，否则进行简单备份
</span><span class="code-line line-number" line="279">  never, simple   总是使用简单备份
</span><span class="code-line line-number" line="280">
</span><span class="code-line line-number" line="281">--quoting-style 选项的有效参数为:
</span><span class="code-line line-number" line="282">
</span><span class="code-line line-number" line="283">  literal
</span><span class="code-line line-number" line="284">  shell
</span><span class="code-line line-number" line="285">  shell-always
</span><span class="code-line line-number" line="286">  c
</span><span class="code-line line-number" line="287">  c-maybe
</span><span class="code-line line-number" line="288">  escape
</span><span class="code-line line-number" line="289">  locale
</span><span class="code-line line-number" line="290">  clocale
</span><span class="code-line line-number" line="291">
</span><span class="code-line line-number" line="292">此 <span class="token function">tar</span> 默认为:
</span><span class="code-line line-number" line="293"><span class="token parameter variable">--format</span><span class="token operator">=</span>gnu -f- <span class="token parameter variable">-b20</span> --quoting-style<span class="token operator">=</span>escape --rmt-command<span class="token operator">=</span>/etc/rmt
</span><span class="code-line line-number" line="294">--rsh-command<span class="token operator">=</span>/usr/bin/ssh
</span></code><div onclick="copied(this)" data-code="-A, --catenate, --concatenate   追加 tar 文件至归档
-c, --create               创建一个新归档
-d, --diff, --compare      找出归档和文件系统的差异
    --delete               从归档(非磁带！)中删除
-r, --append               追加文件至归档结尾
-t, --list                 列出归档内容
    --test-label           测试归档卷标并退出
-u, --update               仅追加比归档中副本更新的文件
-x, --extract, --get       从归档中解出文件

操作修饰符:

      --check-device         当创建增量归档时检查设备号(默认)
  -g, --listed-incremental=FILE   处理新式的 GNU 格式的增量备份
  -G, --incremental          处理老式的 GNU 格式的增量备份
      --ignore-failed-read
                             当遇上不可读文件时不要以非零值退出
      --level=NUMBER         所创建的增量列表归档的输出级别
  -n, --seek                 归档可检索
      --no-check-device      当创建增量归档时不要检查设备号
      --no-seek              归档不可检索
      --occurrence[=NUMBER]  仅处理归档中每个文件的第 NUMBER
                             个事件；仅当与以下子命令 --delete,
                             --diff, --extract 或是 --list
                             中的一个联合使用时，此选项才有效。而且不管文件列表是以命令行形式给出或是通过
                             -T 选项指定的；NUMBER 值默认为 1
      --sparse-version=MAJOR[.MINOR]
                             设置所用的离散格式版本(隐含
                             --sparse)
  -S, --sparse               高效处理离散文件

 重写控制:

  -k, --keep-old-files       don&#x27;t replace existing files when extracting,
                             treat them as errors
      --keep-directory-symlink   preserve existing symlinks to directories when
                             extracting
      --keep-newer-files
                             不要替换比归档中副本更新的已存在的文件
      --no-overwrite-dir     保留已存在目录的元数据
      --overwrite            解压时重写存在的文件
      --overwrite-dir        解压时重写已存在目录的元数据(默认)

      --recursive-unlink     解压目录之前先清除目录层次
      --remove-files         在添加文件至归档后删除它们
      --skip-old-files       don&#x27;t replace existing files when extracting,
                             silently skip over them
  -U, --unlink-first         在解压要重写的文件之前先删除它们
  -W, --verify               在写入以后尝试校验归档

 选择输出流:

      --ignore-command-error 忽略子进程的退出代码
      --no-ignore-command-error
                             将子进程的非零退出代码认为发生错误
  -O, --to-stdout            解压文件至标准输出
      --to-command=COMMAND
                             将解压的文件通过管道传送至另一个程序

 操作文件属性:

      --atime-preserve[=METHOD]
                             在输出的文件上保留访问时间，要么通过在读取(默认
                             METHOD=‘replace’)后还原时间，要不就不要在第一次(METHOD=‘system’)设置时间
      --delay-directory-restore
                             直到解压结束才设置修改时间和所解目录的权限
      --group=名称         强制将 NAME
                             作为所添加的文件的组所有者
      --mode=CHANGES         强制将所添加的文件(符号)更改为权限
                             CHANGES
      --mtime=DATE-OR-FILE   从 DATE-OR-FILE 中为添加的文件设置
                             mtime
  -m, --touch                不要解压文件的修改时间
      --no-delay-directory-restore
                             取消 --delay-directory-restore 选项的效果
      --no-same-owner
                             将文件解压为您所有(普通用户默认此项)
      --no-same-permissions
                             从归档中解压权限时使用用户的掩码位(默认为普通用户服务)
      --numeric-owner        总是以数字代表用户/组的名称
      --owner=名称         强制将 NAME
                             作为所添加的文件的所有者
  -p, --preserve-permissions, --same-permissions
                             解压文件权限信息(默认只为超级用户服务)
      --preserve             与 -p 和 -s 一样
      --same-owner
                             尝试解压时保持所有者关系一致(超级用户默认此项)
  -s, --preserve-order, --same-order
                             member arguments are listed in the same order as
                             the files in the archive

 Handling of extended file attributes:

      --acls                 Enable the POSIX ACLs support
      --no-acls              Disable the POSIX ACLs support
      --no-selinux           Disable the SELinux context support
      --no-xattrs            Disable extended attributes support
      --selinux              Enable the SELinux context support
      --xattrs               Enable extended attributes support
      --xattrs-exclude=MASK  specify the exclude pattern for xattr keys
      --xattrs-include=MASK  specify the include pattern for xattr keys

 设备选择和切换:

  -f, --file=ARCHIVE         使用归档文件或 ARCHIVE 设备
      --force-local
                             即使归档文件存在副本还是把它认为是本地归档
  -F, --info-script=名称, --new-volume-script=名称
                             在每卷磁带最后运行脚本(隐含 -M)
  -L, --tape-length=NUMBER   写入 NUMBER × 1024 字节后更换磁带
  -M, --multi-volume         创建/列出/解压多卷归档文件
      --rmt-command=COMMAND  使用指定的 rmt COMMAND 代替 rmt
      --rsh-command=COMMAND  使用远程 COMMAND 代替 rsh
      --volno-file=FILE      使用/更新 FILE 中的卷数

 设备分块:

  -b, --blocking-factor=BLOCKS   每个记录 BLOCKS x 512 字节
  -B, --read-full-records    读取时重新分块(只对 4.2BSD 管道有效)
  -i, --ignore-zeros         忽略归档中的零字节块(即文件结尾)
      --record-size=NUMBER   每个记录的字节数 NUMBER，乘以 512

 选择归档格式:

  -H, --format=FORMAT        创建指定格式的归档

 FORMAT 是以下格式中的一种:

    gnu                      GNU tar 1.13.x 格式
    oldgnu                   GNU 格式 as per tar <= 1.12
    pax                      POSIX 1003.1-2001 (pax) 格式
    posix                    等同于 pax
    ustar                    POSIX 1003.1-1988 (ustar) 格式
    v7                       old V7 tar 格式

      --old-archive, --portability
                             等同于 --format=v7
      --pax-option=关键字[[:]=值][,关键字[[:]=值]]...
                             控制 pax 关键字
      --posix                等同于 --format=posix
  -V, --label=TEXT           创建带有卷名 TEXT
                             的归档；在列出/解压时，使用 TEXT
                             作为卷名的模式串

 压缩选项:

  -a, --auto-compress        使用归档后缀名来决定压缩程序
  -I, --use-compress-program=PROG
                             通过 PROG 过滤(必须是能接受 -d
                             选项的程序)
  -j, --bzip2                通过 bzip2 过滤归档
  -J, --xz                   通过 xz 过滤归档
      --lzip                 通过 lzip 过滤归档
      --lzma                 通过 lzma 过滤归档
      --lzop
      --no-auto-compress     不使用归档后缀名来决定压缩程序
  -z, --gzip, --gunzip, --ungzip   通过 gzip 过滤归档
  -Z, --compress, --uncompress   通过 compress 过滤归档

 本地文件选择:

      --add-file=FILE        添加指定的 FILE 至归档(如果名字以 -
                             开始会很有用的)
      --backup[=CONTROL]     在删除前备份，选择 CONTROL 版本
  -C, --directory=DIR        改变至目录 DIR
      --exclude=PATTERN      排除以 PATTERN 指定的文件
      --exclude-backups      排除备份和锁文件
      --exclude-caches       除标识文件本身外，排除包含
                             CACHEDIR.TAG 的目录中的内容
      --exclude-caches-all   排除包含 CACHEDIR.TAG 的目录
      --exclude-caches-under 排除包含 CACHEDIR.TAG 的目录中所有内容

      --exclude-tag=FILE     除 FILE 自身外，排除包含 FILE
                             的目录中的内容
      --exclude-tag-all=FILE 排除包含 FILE 的目录
      --exclude-tag-under=FILE   排除包含 FILE 的目录中的所有内容
      --exclude-vcs          排除版本控制系统目录
  -h, --dereference
                             跟踪符号链接；将它们所指向的文件归档并输出
      --hard-dereference
                             跟踪硬链接；将它们所指向的文件归档并输出
  -K, --starting-file=MEMBER-NAME
                             begin at member MEMBER-NAME when reading the
                             archive
      --newer-mtime=DATE     当只有数据改变时比较数据和时间
      --no-null              禁用上一次的效果 --null 选项
      --no-recursion         避免目录中的自动降级
      --no-unquote           不以 -T 读取的文件名作为引用结束
      --null                 -T 读取以空终止的名字，-C 禁用
  -N, --newer=DATE-OR-FILE, --after-date=DATE-OR-FILE
                             只保存比 DATE-OR-FILE 更新的文件
      --one-file-system      创建归档时保存在本地文件系统中
  -P, --absolute-names       不要从文件名中清除引导符‘/’
      --recursion            目录递归(默认)
      --suffix=STRING        在删除前备份，除非被环境变量
                             SIMPLE_BACKUP_SUFFIX
                             覆盖，否则覆盖常用后缀(‘’)
  -T, --files-from=FILE      从 FILE
                             中获取文件名来解压或创建文件
      --unquote              以 -T
                             读取的文件名作为引用结束(默认)
  -X, --exclude-from=FILE    排除 FILE 中列出的模式串

 文件名变换:

      --strip-components=NUMBER   解压时从文件名中清除 NUMBER
                             个引导部分
      --transform=EXPRESSION, --xform=EXPRESSION
                             使用 sed 代替 EXPRESSION
                             来进行文件名变换

 文件名匹配选项(同时影响排除和包括模式串):

      --anchored             模式串匹配文件名头部
      --ignore-case          忽略大小写
      --no-anchored          模式串匹配任意‘/’后字符(默认对
                             exclusion 有效)
      --no-ignore-case       匹配大小写(默认)
      --no-wildcards         逐字匹配字符串
      --no-wildcards-match-slash   通配符不匹配‘/’
      --wildcards            use wildcards (default)
      --wildcards-match-slash
                             通配符匹配‘/’(默认对排除操作有效)

 提示性输出:

      --checkpoint[=NUMBER]  每隔 NUMBER
                             个记录显示进度信息(默认为 10 个)
      --checkpoint-action=ACTION   在每个检查点上执行 ACTION
      --full-time            print file time to its full resolution
      --index-file=FILE      将详细输出发送至 FILE
  -l, --check-links
                             只要不是所有链接都被输出就打印信息
      --no-quote-chars=STRING   禁用来自 STRING 的字符引用
      --quote-chars=STRING   来自 STRING 的额外的引用字符
      --quoting-style=STYLE  设置名称引用风格；有效的 STYLE
                             值请参阅以下说明
  -R, --block-number         每个信息都显示归档内的块数
      --show-defaults        显示 tar 默认选项
      --show-omitted-dirs
                             列表或解压时，列出每个不匹配查找标准的目录
      --show-transformed-names, --show-stored-names
                             显示变换后的文件名或归档名
      --totals[=SIGNAL]      处理归档后打印出总字节数；当此
                             SIGNAL 被触发时带参数 -
                             打印总字节数；允许的信号为:
                             SIGHUP，SIGQUIT，SIGINT，SIGUSR1 和
                             SIGUSR2；同时也接受不带 SIG
                             前缀的信号名称
      --utc                  以 UTC 格式打印文件修改时间
  -v, --verbose              详细地列出处理的文件
      --warning=KEYWORD      警告控制:
  -w, --interactive, --confirmation
                             每次操作都要求确认

 兼容性选项:

  -o                         创建归档时，相当于
                             --old-archive；展开归档时，相当于
                             --no-same-owner

 其它选项:

  -?, --help                 显示此帮助列表
      --restrict             禁用某些潜在的有危险的选项
      --usage                显示简短的用法说明
      --version              打印程序版本

长选项和相应短选项具有相同的强制参数或可选参数。

除非以 --suffix 或 SIMPLE_BACKUP_SUFFIX
设置备份后缀，否则备份后缀就是“~”。
可以用 --backup 或 VERSION_CONTROL 设置版本控制，可能的值为：

  none, off	   从不做备份
  t, numbered     进行编号备份
  nil, existing
如果编号备份存在则进行编号备份，否则进行简单备份
  never, simple   总是使用简单备份

--quoting-style 选项的有效参数为:

  literal
  shell
  shell-always
  c
  c-maybe
  escape
  locale
  clocale

此 tar 默认为:
--format=gnu -f- -b20 --quoting-style=escape --rmt-command=/etc/rmt
--rsh-command=/usr/bin/ssh
" class="copied"><svg class="octicon-copy" aria-hidden="true" viewBox="0 0 16 16" fill="currentColor" height="12" width="12"><path fill-rule="evenodd" d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 010 1.5h-1.5a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-1.5a.75.75 0 011.5 0v1.5A1.75 1.75 0 019.25 16h-7.5A1.75 1.75 0 010 14.25v-7.5z"></path><path fill-rule="evenodd" d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0114.25 11h-7.5A1.75 1.75 0 015 9.25v-7.5zm1.75-.25a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-7.5a.25.25 0 00-.25-.25h-7.5z"></path></svg><svg class="octicon-check" aria-hidden="true" viewBox="0 0 16 16" fill="currentColor" height="12" width="12"><path fill-rule="evenodd" d="M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.06 0z"></path></svg></div></pre>
<h3 id="参数"><a class="anchor" aria-hidden="true" tabindex="-1" href="#参数"><span class="octicon octicon-link"></span></a>参数</h3>
<p>文件或目录：指定要打包的文件或目录列表。</p>
<h3 id="实例"><a class="anchor" aria-hidden="true" tabindex="-1" href="#实例"><span class="octicon octicon-link"></span></a>实例</h3>
<p>将 <code>/home/vivek/bin/</code> 目录打包，并使用 gzip 算法压缩。保存为 <code>/tmp/bin-backup.tar.gz</code> 文件。</p>
<pre><code class="code-highlight"><span class="code-line line-number" line="1">tar -zcvf /tmp/bin-backup.tar.gz /home/vivek/bin/
</span></code><div onclick="copied(this)" data-code="tar -zcvf /tmp/bin-backup.tar.gz /home/vivek/bin/
" class="copied"><svg class="octicon-copy" aria-hidden="true" viewBox="0 0 16 16" fill="currentColor" height="12" width="12"><path fill-rule="evenodd" d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 010 1.5h-1.5a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-1.5a.75.75 0 011.5 0v1.5A1.75 1.75 0 019.25 16h-7.5A1.75 1.75 0 010 14.25v-7.5z"></path><path fill-rule="evenodd" d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0114.25 11h-7.5A1.75 1.75 0 015 9.25v-7.5zm1.75-.25a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-7.5a.25.25 0 00-.25-.25h-7.5z"></path></svg><svg class="octicon-check" aria-hidden="true" viewBox="0 0 16 16" fill="currentColor" height="12" width="12"><path fill-rule="evenodd" d="M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.06 0z"></path></svg></div></pre>
<pre class="language-shell"><code class="language-shell code-highlight"><span class="code-line line-number" line="1">- z：有gzip属性的
</span><span class="code-line line-number" line="2">- j：有bz2属性的
</span><span class="code-line line-number" line="3">- Z：有compress属性的
</span><span class="code-line line-number" line="4">- v：显示所有过程
</span><span class="code-line line-number" line="5">- O：将文件解开到标准输出
</span></code><div onclick="copied(this)" data-code="- z：有gzip属性的
- j：有bz2属性的
- Z：有compress属性的
- v：显示所有过程
- O：将文件解开到标准输出
" class="copied"><svg class="octicon-copy" aria-hidden="true" viewBox="0 0 16 16" fill="currentColor" height="12" width="12"><path fill-rule="evenodd" d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 010 1.5h-1.5a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-1.5a.75.75 0 011.5 0v1.5A1.75 1.75 0 019.25 16h-7.5A1.75 1.75 0 010 14.25v-7.5z"></path><path fill-rule="evenodd" d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0114.25 11h-7.5A1.75 1.75 0 015 9.25v-7.5zm1.75-.25a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-7.5a.25.25 0 00-.25-.25h-7.5z"></path></svg><svg class="octicon-check" aria-hidden="true" viewBox="0 0 16 16" fill="currentColor" height="12" width="12"><path fill-rule="evenodd" d="M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.06 0z"></path></svg></div></pre>
<pre class="language-shell"><code class="language-shell code-highlight"><span class="code-line line-number" line="1"><span class="token function">tar</span> <span class="token parameter variable">-cf</span> archive.tar foo bar  <span class="token comment"># 从文件 foo 和 bar 创建归档文件 archive.tar。</span>
</span><span class="code-line line-number" line="2"><span class="token function">tar</span> <span class="token parameter variable">-tvf</span> archive.tar         <span class="token comment"># 详细列举归档文件 archive.tar 中的所有文件。</span>
</span><span class="code-line line-number" line="3"><span class="token function">tar</span> <span class="token parameter variable">-xf</span> archive.tar          <span class="token comment"># 展开归档文件 archive.tar 中的所有文件。</span>
</span></code><div onclick="copied(this)" data-code="tar -cf archive.tar foo bar  # 从文件 foo 和 bar 创建归档文件 archive.tar。
tar -tvf archive.tar         # 详细列举归档文件 archive.tar 中的所有文件。
tar -xf archive.tar          # 展开归档文件 archive.tar 中的所有文件。
" class="copied"><svg class="octicon-copy" aria-hidden="true" viewBox="0 0 16 16" fill="currentColor" height="12" width="12"><path fill-rule="evenodd" d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 010 1.5h-1.5a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-1.5a.75.75 0 011.5 0v1.5A1.75 1.75 0 019.25 16h-7.5A1.75 1.75 0 010 14.25v-7.5z"></path><path fill-rule="evenodd" d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0114.25 11h-7.5A1.75 1.75 0 015 9.25v-7.5zm1.75-.25a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-7.5a.25.25 0 00-.25-.25h-7.5z"></path></svg><svg class="octicon-check" aria-hidden="true" viewBox="0 0 16 16" fill="currentColor" height="12" width="12"><path fill-rule="evenodd" d="M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.06 0z"></path></svg></div></pre>
<p>下面的参数-f是必须的</p>
<p>-f: 使用档案名字，切记，这个参数是最后一个参数，后面只能接档案名。</p>
<pre class="language-shell"><code class="language-shell code-highlight"><span class="code-line line-number" line="1"><span class="token function">tar</span> <span class="token parameter variable">-cf</span> all.tar *.jpg
</span><span class="code-line line-number" line="2"><span class="token comment"># 这条命令是将所有.jpg的文件打成一个名为all.tar的包。-c是表示产生新的包，-f指定包的文件名。</span>
</span><span class="code-line line-number" line="3">
</span><span class="code-line line-number" line="4"><span class="token function">tar</span> <span class="token parameter variable">-rf</span> all.tar *.gif
</span><span class="code-line line-number" line="5"><span class="token comment"># 这条命令是将所有.gif的文件增加到all.tar的包里面去。-r是表示增加文件的意思。</span>
</span><span class="code-line line-number" line="6">
</span><span class="code-line line-number" line="7"><span class="token function">tar</span> <span class="token parameter variable">-uf</span> all.tar logo.gif
</span><span class="code-line line-number" line="8"><span class="token comment"># 这条命令是更新原来tar包all.tar中logo.gif文件，-u是表示更新文件的意思。</span>
</span><span class="code-line line-number" line="9">
</span><span class="code-line line-number" line="10"><span class="token function">tar</span> <span class="token parameter variable">-tf</span> all.tar
</span><span class="code-line line-number" line="11"><span class="token comment"># 这条命令是列出all.tar包中所有文件，-t是列出文件的意思</span>
</span></code><div onclick="copied(this)" data-code="tar -cf all.tar *.jpg
# 这条命令是将所有.jpg的文件打成一个名为all.tar的包。-c是表示产生新的包，-f指定包的文件名。

tar -rf all.tar *.gif
# 这条命令是将所有.gif的文件增加到all.tar的包里面去。-r是表示增加文件的意思。

tar -uf all.tar logo.gif
# 这条命令是更新原来tar包all.tar中logo.gif文件，-u是表示更新文件的意思。

tar -tf all.tar
# 这条命令是列出all.tar包中所有文件，-t是列出文件的意思
" class="copied"><svg class="octicon-copy" aria-hidden="true" viewBox="0 0 16 16" fill="currentColor" height="12" width="12"><path fill-rule="evenodd" d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 010 1.5h-1.5a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-1.5a.75.75 0 011.5 0v1.5A1.75 1.75 0 019.25 16h-7.5A1.75 1.75 0 010 14.25v-7.5z"></path><path fill-rule="evenodd" d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0114.25 11h-7.5A1.75 1.75 0 015 9.25v-7.5zm1.75-.25a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-7.5a.25.25 0 00-.25-.25h-7.5z"></path></svg><svg class="octicon-check" aria-hidden="true" viewBox="0 0 16 16" fill="currentColor" height="12" width="12"><path fill-rule="evenodd" d="M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.06 0z"></path></svg></div></pre>
<pre class="language-shell"><code class="language-shell code-highlight"><span class="code-line line-number" line="1"><span class="token function">tar</span> <span class="token parameter variable">-cvf</span> archive.tar foo bar  <span class="token comment"># 从文件foo和bar创建archive.tar。</span>
</span><span class="code-line line-number" line="2"><span class="token function">tar</span> <span class="token parameter variable">-tvf</span> archive.tar         <span class="token comment"># 详细列出archive.tar中的所有文件。</span>
</span><span class="code-line line-number" line="3"><span class="token function">tar</span> <span class="token parameter variable">-xf</span> archive.tar          <span class="token comment"># 从archive.tar提取所有文件。</span>
</span></code><div onclick="copied(this)" data-code="tar -cvf archive.tar foo bar  # 从文件foo和bar创建archive.tar。
tar -tvf archive.tar         # 详细列出archive.tar中的所有文件。
tar -xf archive.tar          # 从archive.tar提取所有文件。
" class="copied"><svg class="octicon-copy" aria-hidden="true" viewBox="0 0 16 16" fill="currentColor" height="12" width="12"><path fill-rule="evenodd" d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 010 1.5h-1.5a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-1.5a.75.75 0 011.5 0v1.5A1.75 1.75 0 019.25 16h-7.5A1.75 1.75 0 010 14.25v-7.5z"></path><path fill-rule="evenodd" d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0114.25 11h-7.5A1.75 1.75 0 015 9.25v-7.5zm1.75-.25a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-7.5a.25.25 0 00-.25-.25h-7.5z"></path></svg><svg class="octicon-check" aria-hidden="true" viewBox="0 0 16 16" fill="currentColor" height="12" width="12"><path fill-rule="evenodd" d="M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.06 0z"></path></svg></div></pre>
<h4 id="zip格式"><a class="anchor" aria-hidden="true" tabindex="-1" href="#zip格式"><span class="octicon octicon-link"></span></a>zip格式</h4>
<p>压缩： zip -r [目标文件名].zip [原文件/目录名]<br>解压： unzip [原文件名].zip<br>注：-r参数代表递归</p>
<h4 id="tar格式该格式仅仅打包不压缩"><a class="anchor" aria-hidden="true" tabindex="-1" href="#tar格式该格式仅仅打包不压缩"><span class="octicon octicon-link"></span></a>tar格式（该格式仅仅打包，不压缩）</h4>
<p>打包：tar -cvf [目标文件名].tar [原文件名/目录名]<br>解包：tar -xvf [原文件名].tar<br>注：c参数代表create（创建），x参数代表extract（解包），v参数代表verbose（详细信息），f参数代表filename（文件名），所以f后必须接文件名。</p>
<h4 id="targz格式"><a class="anchor" aria-hidden="true" tabindex="-1" href="#targz格式"><span class="octicon octicon-link"></span></a>tar.gz格式</h4>
<p>方式一：利用前面已经打包好的tar文件，直接用压缩命令。</p>
<p>压缩：gzip [原文件名].tar<br>解压：gunzip [原文件名].tar.gz</p>
<p>方式二：一次性打包并压缩、解压并解包</p>
<p>打包并压缩： tar -zcvf [目标文件名].tar.gz [原文件名/目录名]<br>解压并解包： tar -zxvf [原文件名].tar.gz<br>注：z代表用gzip算法来压缩/解压。</p>
<h4 id="tarbz2格式"><a class="anchor" aria-hidden="true" tabindex="-1" href="#tarbz2格式"><span class="octicon octicon-link"></span></a>tar.bz2格式</h4>
<p>方式一：利用已经打包好的tar文件，直接执行压缩命令：</p>
<p>压缩：bzip2 [原文件名].tar<br>解压：bunzip2 [原文件名].tar.bz2<br>方式二：一次性打包并压缩、解压并解包</p>
<p>打包并压缩： tar -jcvf [目标文件名].tar.bz2 [原文件名/目录名]<br>解压并解包： tar -jxvf [原文件名].tar.bz2<br>注：小写j代表用bzip2算法来压缩/解压。</p>
<h4 id="tarxz格式"><a class="anchor" aria-hidden="true" tabindex="-1" href="#tarxz格式"><span class="octicon octicon-link"></span></a>tar.xz格式</h4>
<p>方式一：利用已经打包好的tar文件，直接用压缩命令：</p>
<p>压缩：xz [原文件名].tar<br>解压：unxz [原文件名].tar.xz<br>方式二：一次性打包并压缩、解压并解包</p>
<p>打包并压缩： tar -Jcvf [目标文件名].tar.xz [原文件名/目录名]<br>解压并解包： tar -Jxvf [原文件名].tar.xz<br>注：大写J代表用xz算法来压缩/解压。</p>
<h4 id="tarz格式已过时"><a class="anchor" aria-hidden="true" tabindex="-1" href="#tarz格式已过时"><span class="octicon octicon-link"></span></a>tar.Z格式（已过时）</h4>
<p>方式一：利用已经打包好的tar文件，直接用压缩命令：</p>
<p>压缩：compress [原文件名].tar<br>解压：uncompress [原文件名].tar.Z<br>方式二：一次性打包并压缩、解压并解包</p>
<p>打包并压缩： tar -Zcvf [目标文件名].tar.Z [原文件名/目录名]<br>解压并解包： tar -Zxvf [原文件名].tar.Z<br>注：大写Z代表用ncompress算法来压缩/解压。另，ncompress是早期Unix系统的压缩格式，但由于ncompress的压缩率太低，现已过时。</p>
<h4 id="jar格式"><a class="anchor" aria-hidden="true" tabindex="-1" href="#jar格式"><span class="octicon octicon-link"></span></a>jar格式</h4>
<p>压缩：jar -cvf [目标文件名].jar [原文件名/目录名]<br>解压：jar -xvf [原文件名].jar</p>
<p>注：如果是打包的是Java类库，并且该类库中存在主类，那么需要写一个META-INF/MANIFEST.MF配置文件，内容如下：</p>
<pre class="language-shell"><code class="language-shell code-highlight"><span class="code-line line-number" line="1">Manifest-Version: <span class="token number">1.0</span>
</span><span class="code-line line-number" line="2">Created-By: <span class="token number">1.6</span>.0_27 <span class="token punctuation">(</span>Sun Microsystems Inc.<span class="token punctuation">)</span>
</span><span class="code-line line-number" line="3">Main-class: the_name_of_the_main_class_should_be_put_here
</span></code><div onclick="copied(this)" data-code="Manifest-Version: 1.0
Created-By: 1.6.0_27 (Sun Microsystems Inc.)
Main-class: the_name_of_the_main_class_should_be_put_here
" class="copied"><svg class="octicon-copy" aria-hidden="true" viewBox="0 0 16 16" fill="currentColor" height="12" width="12"><path fill-rule="evenodd" d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 010 1.5h-1.5a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-1.5a.75.75 0 011.5 0v1.5A1.75 1.75 0 019.25 16h-7.5A1.75 1.75 0 010 14.25v-7.5z"></path><path fill-rule="evenodd" d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0114.25 11h-7.5A1.75 1.75 0 015 9.25v-7.5zm1.75-.25a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-7.5a.25.25 0 00-.25-.25h-7.5z"></path></svg><svg class="octicon-check" aria-hidden="true" viewBox="0 0 16 16" fill="currentColor" height="12" width="12"><path fill-rule="evenodd" d="M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.06 0z"></path></svg></div></pre>
<p>然后用如下命令打包：</p>
<p>jar -cvfm [目标文件名].jar META-INF/MANIFEST.MF [原文件名/目录名]<br>这样以后就能用“java -jar [文件名].jar”命令直接运行主类中的public static void main方法了。</p>
<h4 id="7z格式"><a class="anchor" aria-hidden="true" tabindex="-1" href="#7z格式"><span class="octicon octicon-link"></span></a>7z格式</h4>
<p>压缩：7z a [目标文件名].7z [原文件名/目录名]<br>解压：7z x [原文件名].7z<br>注：这个7z解压命令支持rar格式，即：</p>
<p>7z x [原文件名].rar</p>
<h4 id="其它例子"><a class="anchor" aria-hidden="true" tabindex="-1" href="#其它例子"><span class="octicon octicon-link"></span></a>其它例子</h4>
<p><strong>将文件全部打包成tar包</strong> ：</p>
<pre class="language-shell"><code class="language-shell code-highlight"><span class="code-line line-number" line="1"><span class="token function">tar</span> <span class="token parameter variable">-cvf</span> log.tar log2012.log    仅打包，不压缩！
</span><span class="code-line line-number" line="2"><span class="token function">tar</span> <span class="token parameter variable">-zcvf</span> log.tar.gz log2012.log   打包后，以 <span class="token function">gzip</span> 压缩
</span><span class="code-line line-number" line="3"><span class="token function">tar</span> <span class="token parameter variable">-jcvf</span> log.tar.bz2 log2012.log  打包后，以 <span class="token function">bzip2</span> 压缩
</span></code><div onclick="copied(this)" data-code="tar -cvf log.tar log2012.log    仅打包，不压缩！
tar -zcvf log.tar.gz log2012.log   打包后，以 gzip 压缩
tar -jcvf log.tar.bz2 log2012.log  打包后，以 bzip2 压缩
" class="copied"><svg class="octicon-copy" aria-hidden="true" viewBox="0 0 16 16" fill="currentColor" height="12" width="12"><path fill-rule="evenodd" d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 010 1.5h-1.5a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-1.5a.75.75 0 011.5 0v1.5A1.75 1.75 0 019.25 16h-7.5A1.75 1.75 0 010 14.25v-7.5z"></path><path fill-rule="evenodd" d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0114.25 11h-7.5A1.75 1.75 0 015 9.25v-7.5zm1.75-.25a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-7.5a.25.25 0 00-.25-.25h-7.5z"></path></svg><svg class="octicon-check" aria-hidden="true" viewBox="0 0 16 16" fill="currentColor" height="12" width="12"><path fill-rule="evenodd" d="M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.06 0z"></path></svg></div></pre>
<p>在选项<code>f</code>之后的文件档名是自己取的，我们习惯上都用 .tar 来作为辨识。 如果加<code>z</code>选项，则以.tar.gz或.tgz来代表gzip压缩过的tar包；如果加<code>j</code>选项，则以.tar.bz2来作为tar包名。</p>
<p><strong>解压目录</strong></p>
<p>参数--strip-components NUMBER，在提取时从文件名中删除NUMBER个前导组件，如要去除前二层，参数为--strip-components 2</p>
<pre class="language-shell"><code class="language-shell code-highlight"><span class="code-line line-number" line="1"><span class="token function">tar</span> <span class="token parameter variable">-xvf</span> portal-web-v2.0.0.tar --strip-components <span class="token number">1</span>  <span class="token parameter variable">-C</span> 指定目录
</span></code><div onclick="copied(this)" data-code="tar -xvf portal-web-v2.0.0.tar --strip-components 1  -C 指定目录
" class="copied"><svg class="octicon-copy" aria-hidden="true" viewBox="0 0 16 16" fill="currentColor" height="12" width="12"><path fill-rule="evenodd" d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 010 1.5h-1.5a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-1.5a.75.75 0 011.5 0v1.5A1.75 1.75 0 019.25 16h-7.5A1.75 1.75 0 010 14.25v-7.5z"></path><path fill-rule="evenodd" d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0114.25 11h-7.5A1.75 1.75 0 015 9.25v-7.5zm1.75-.25a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-7.5a.25.25 0 00-.25-.25h-7.5z"></path></svg><svg class="octicon-check" aria-hidden="true" viewBox="0 0 16 16" fill="currentColor" height="12" width="12"><path fill-rule="evenodd" d="M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.06 0z"></path></svg></div></pre>
<p>示例</p>
<pre class="language-shell"><code class="language-shell code-highlight"><span class="code-line line-number" line="1"><span class="token function">tar</span> <span class="token parameter variable">-xvf</span> xxx.tar.gz <span class="token parameter variable">-C</span> /usr/src/a
</span><span class="code-line line-number" line="2">/usr/src/a/xxxxx/src/opp/b.txt
</span></code><div onclick="copied(this)" data-code="tar -xvf xxx.tar.gz -C /usr/src/a
/usr/src/a/xxxxx/src/opp/b.txt
" class="copied"><svg class="octicon-copy" aria-hidden="true" viewBox="0 0 16 16" fill="currentColor" height="12" width="12"><path fill-rule="evenodd" d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 010 1.5h-1.5a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-1.5a.75.75 0 011.5 0v1.5A1.75 1.75 0 019.25 16h-7.5A1.75 1.75 0 010 14.25v-7.5z"></path><path fill-rule="evenodd" d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0114.25 11h-7.5A1.75 1.75 0 015 9.25v-7.5zm1.75-.25a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-7.5a.25.25 0 00-.25-.25h-7.5z"></path></svg><svg class="octicon-check" aria-hidden="true" viewBox="0 0 16 16" fill="currentColor" height="12" width="12"><path fill-rule="evenodd" d="M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.06 0z"></path></svg></div></pre>
<pre class="language-shell"><code class="language-shell code-highlight"><span class="code-line line-number" line="1"><span class="token function">tar</span> <span class="token parameter variable">-xvf</span> xxx.tar.gz -strip-components<span class="token operator">=</span><span class="token number">1</span> <span class="token parameter variable">-C</span> /usr/src/a
</span><span class="code-line line-number" line="2">/usr/src/a/src/opp/b.txt
</span></code><div onclick="copied(this)" data-code="tar -xvf xxx.tar.gz -strip-components=1 -C /usr/src/a
/usr/src/a/src/opp/b.txt
" class="copied"><svg class="octicon-copy" aria-hidden="true" viewBox="0 0 16 16" fill="currentColor" height="12" width="12"><path fill-rule="evenodd" d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 010 1.5h-1.5a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-1.5a.75.75 0 011.5 0v1.5A1.75 1.75 0 019.25 16h-7.5A1.75 1.75 0 010 14.25v-7.5z"></path><path fill-rule="evenodd" d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0114.25 11h-7.5A1.75 1.75 0 015 9.25v-7.5zm1.75-.25a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-7.5a.25.25 0 00-.25-.25h-7.5z"></path></svg><svg class="octicon-check" aria-hidden="true" viewBox="0 0 16 16" fill="currentColor" height="12" width="12"><path fill-rule="evenodd" d="M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.06 0z"></path></svg></div></pre>
<p><strong>查阅上述tar包内有哪些文件</strong> ：</p>
<pre class="language-shell"><code class="language-shell code-highlight"><span class="code-line line-number" line="1"><span class="token function">tar</span> <span class="token parameter variable">-ztvf</span> log.tar.gz
</span></code><div onclick="copied(this)" data-code="tar -ztvf log.tar.gz
" class="copied"><svg class="octicon-copy" aria-hidden="true" viewBox="0 0 16 16" fill="currentColor" height="12" width="12"><path fill-rule="evenodd" d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 010 1.5h-1.5a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-1.5a.75.75 0 011.5 0v1.5A1.75 1.75 0 019.25 16h-7.5A1.75 1.75 0 010 14.25v-7.5z"></path><path fill-rule="evenodd" d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0114.25 11h-7.5A1.75 1.75 0 015 9.25v-7.5zm1.75-.25a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-7.5a.25.25 0 00-.25-.25h-7.5z"></path></svg><svg class="octicon-check" aria-hidden="true" viewBox="0 0 16 16" fill="currentColor" height="12" width="12"><path fill-rule="evenodd" d="M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.06 0z"></path></svg></div></pre>
<p>由于我们使用 gzip 压缩的log.tar.gz，所以要查阅log.tar.gz包内的文件时，就得要加上<code>z</code>这个选项了。</p>
<p><strong>将tar包解压缩</strong> ：</p>
<pre class="language-shell"><code class="language-shell code-highlight"><span class="code-line line-number" line="1"><span class="token function">tar</span> <span class="token parameter variable">-zxvf</span> /opt/soft/test/log.tar.gz
</span></code><div onclick="copied(this)" data-code="tar -zxvf /opt/soft/test/log.tar.gz
" class="copied"><svg class="octicon-copy" aria-hidden="true" viewBox="0 0 16 16" fill="currentColor" height="12" width="12"><path fill-rule="evenodd" d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 010 1.5h-1.5a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-1.5a.75.75 0 011.5 0v1.5A1.75 1.75 0 019.25 16h-7.5A1.75 1.75 0 010 14.25v-7.5z"></path><path fill-rule="evenodd" d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0114.25 11h-7.5A1.75 1.75 0 015 9.25v-7.5zm1.75-.25a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-7.5a.25.25 0 00-.25-.25h-7.5z"></path></svg><svg class="octicon-check" aria-hidden="true" viewBox="0 0 16 16" fill="currentColor" height="12" width="12"><path fill-rule="evenodd" d="M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.06 0z"></path></svg></div></pre>
<p>在预设的情况下，我们可以将压缩档在任何地方解开的</p>
<p><strong>只将tar内的部分文件解压出来</strong> ：</p>
<pre class="language-shell"><code class="language-shell code-highlight"><span class="code-line line-number" line="1"><span class="token function">tar</span> <span class="token parameter variable">-zxvf</span> /opt/soft/test/log30.tar.gz log2013.log
</span></code><div onclick="copied(this)" data-code="tar -zxvf /opt/soft/test/log30.tar.gz log2013.log
" class="copied"><svg class="octicon-copy" aria-hidden="true" viewBox="0 0 16 16" fill="currentColor" height="12" width="12"><path fill-rule="evenodd" d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 010 1.5h-1.5a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-1.5a.75.75 0 011.5 0v1.5A1.75 1.75 0 019.25 16h-7.5A1.75 1.75 0 010 14.25v-7.5z"></path><path fill-rule="evenodd" d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0114.25 11h-7.5A1.75 1.75 0 015 9.25v-7.5zm1.75-.25a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-7.5a.25.25 0 00-.25-.25h-7.5z"></path></svg><svg class="octicon-check" aria-hidden="true" viewBox="0 0 16 16" fill="currentColor" height="12" width="12"><path fill-rule="evenodd" d="M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.06 0z"></path></svg></div></pre>
<p>我可以透过<code>tar -ztvf</code>来查阅 tar 包内的文件名称，如果单只要一个文件，就可以透过这个方式来解压部分文件！</p>
<p><strong>文件备份下来，并且保存其权限</strong> ：</p>
<pre class="language-shell"><code class="language-shell code-highlight"><span class="code-line line-number" line="1"><span class="token function">tar</span> <span class="token parameter variable">-zcvpf</span> log31.tar.gz log2014.log log2015.log log2016.log
</span></code><div onclick="copied(this)" data-code="tar -zcvpf log31.tar.gz log2014.log log2015.log log2016.log
" class="copied"><svg class="octicon-copy" aria-hidden="true" viewBox="0 0 16 16" fill="currentColor" height="12" width="12"><path fill-rule="evenodd" d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 010 1.5h-1.5a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-1.5a.75.75 0 011.5 0v1.5A1.75 1.75 0 019.25 16h-7.5A1.75 1.75 0 010 14.25v-7.5z"></path><path fill-rule="evenodd" d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0114.25 11h-7.5A1.75 1.75 0 015 9.25v-7.5zm1.75-.25a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-7.5a.25.25 0 00-.25-.25h-7.5z"></path></svg><svg class="octicon-check" aria-hidden="true" viewBox="0 0 16 16" fill="currentColor" height="12" width="12"><path fill-rule="evenodd" d="M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.06 0z"></path></svg></div></pre>
<p>这个<code>-p</code>的属性是很重要的，尤其是当您要保留原本文件的属性时。</p>
<p><strong>在文件夹当中，比某个日期新的文件才备份</strong> ：</p>
<pre class="language-shell"><code class="language-shell code-highlight"><span class="code-line line-number" line="1"><span class="token function">tar</span> <span class="token parameter variable">-N</span> <span class="token string">"2012/11/13"</span> <span class="token parameter variable">-zcvf</span> log17.tar.gz <span class="token builtin class-name">test</span>
</span></code><div onclick="copied(this)" data-code="tar -N &#x22;2012/11/13&#x22; -zcvf log17.tar.gz test
" class="copied"><svg class="octicon-copy" aria-hidden="true" viewBox="0 0 16 16" fill="currentColor" height="12" width="12"><path fill-rule="evenodd" d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 010 1.5h-1.5a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-1.5a.75.75 0 011.5 0v1.5A1.75 1.75 0 019.25 16h-7.5A1.75 1.75 0 010 14.25v-7.5z"></path><path fill-rule="evenodd" d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0114.25 11h-7.5A1.75 1.75 0 015 9.25v-7.5zm1.75-.25a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-7.5a.25.25 0 00-.25-.25h-7.5z"></path></svg><svg class="octicon-check" aria-hidden="true" viewBox="0 0 16 16" fill="currentColor" height="12" width="12"><path fill-rule="evenodd" d="M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.06 0z"></path></svg></div></pre>
<p><strong>备份文件夹内容是排除部分文件：</strong></p>
<pre class="language-shell"><code class="language-shell code-highlight"><span class="code-line line-number" line="1"><span class="token function">tar</span> <span class="token parameter variable">--exclude</span> scf/service <span class="token parameter variable">-zcvf</span> scf.tar.gz scf/*
</span></code><div onclick="copied(this)" data-code="tar --exclude scf/service -zcvf scf.tar.gz scf/*
" class="copied"><svg class="octicon-copy" aria-hidden="true" viewBox="0 0 16 16" fill="currentColor" height="12" width="12"><path fill-rule="evenodd" d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 010 1.5h-1.5a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-1.5a.75.75 0 011.5 0v1.5A1.75 1.75 0 019.25 16h-7.5A1.75 1.75 0 010 14.25v-7.5z"></path><path fill-rule="evenodd" d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0114.25 11h-7.5A1.75 1.75 0 015 9.25v-7.5zm1.75-.25a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-7.5a.25.25 0 00-.25-.25h-7.5z"></path></svg><svg class="octicon-check" aria-hidden="true" viewBox="0 0 16 16" fill="currentColor" height="12" width="12"><path fill-rule="evenodd" d="M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.06 0z"></path></svg></div></pre>
<p><strong>打包文件之后删除源文件：</strong></p>
<pre class="language-shell"><code class="language-shell code-highlight"><span class="code-line line-number" line="1"><span class="token function">tar</span> <span class="token parameter variable">-cvf</span> test.tar <span class="token builtin class-name">test</span> --remove-files
</span></code><div onclick="copied(this)" data-code="tar -cvf test.tar test --remove-files
" class="copied"><svg class="octicon-copy" aria-hidden="true" viewBox="0 0 16 16" fill="currentColor" height="12" width="12"><path fill-rule="evenodd" d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 010 1.5h-1.5a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-1.5a.75.75 0 011.5 0v1.5A1.75 1.75 0 019.25 16h-7.5A1.75 1.75 0 010 14.25v-7.5z"></path><path fill-rule="evenodd" d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0114.25 11h-7.5A1.75 1.75 0 015 9.25v-7.5zm1.75-.25a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-7.5a.25.25 0 00-.25-.25h-7.5z"></path></svg><svg class="octicon-check" aria-hidden="true" viewBox="0 0 16 16" fill="currentColor" height="12" width="12"><path fill-rule="evenodd" d="M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.06 0z"></path></svg></div></pre>
<p><strong>其实最简单的使用 tar 就只要记忆底下的方式即可：</strong></p>
<pre class="language-shell"><code class="language-shell code-highlight"><span class="code-line line-number" line="1">压　缩：tar <span class="token parameter variable">-jcv</span> <span class="token parameter variable">-f</span> filename.tar.bz2 要被压缩的文件或目录名称
</span><span class="code-line line-number" line="2">查　询：tar <span class="token parameter variable">-jtv</span> <span class="token parameter variable">-f</span> filename.tar.bz2
</span><span class="code-line line-number" line="3">解压缩：tar <span class="token parameter variable">-jxv</span> <span class="token parameter variable">-f</span> filename.tar.bz2 <span class="token parameter variable">-C</span> 欲解压缩的目录
</span></code><div onclick="copied(this)" data-code="压　缩：tar -jcv -f filename.tar.bz2 要被压缩的文件或目录名称
查　询：tar -jtv -f filename.tar.bz2
解压缩：tar -jxv -f filename.tar.bz2 -C 欲解压缩的目录
" class="copied"><svg class="octicon-copy" aria-hidden="true" viewBox="0 0 16 16" fill="currentColor" height="12" width="12"><path fill-rule="evenodd" d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 010 1.5h-1.5a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-1.5a.75.75 0 011.5 0v1.5A1.75 1.75 0 019.25 16h-7.5A1.75 1.75 0 010 14.25v-7.5z"></path><path fill-rule="evenodd" d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0114.25 11h-7.5A1.75 1.75 0 015 9.25v-7.5zm1.75-.25a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-7.5a.25.25 0 00-.25-.25h-7.5z"></path></svg><svg class="octicon-check" aria-hidden="true" viewBox="0 0 16 16" fill="currentColor" height="12" width="12"><path fill-rule="evenodd" d="M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.06 0z"></path></svg></div></pre>
<style>markdown-style pre .copied {
  display: flex;
  position: absolute;
  cursor: pointer;
  color: #a5afbb;
  top: 6px;
  right: 6px;
  border-radius: 5px;
  background: #82828226;
  padding: 6px;
  font-size: 12px;
  transition: all .3s;
}
markdown-style pre .copied:not(.active) {
  visibility: hidden;
}
markdown-style pre:hover .copied {
  visibility: visible;
}
markdown-style pre:hover .copied:hover {
  background: #4caf50;
  color: #fff;
}
markdown-style pre:hover .copied:active,
markdown-style pre .copied.active {
  background: #2e9b33;
  color: #fff;
}
markdown-style pre .copied .octicon-copy {
  display: block;
}
markdown-style pre .copied .octicon-check {
  display: none;
}
markdown-style pre .active .octicon-copy {
  display: none;
}
markdown-style pre .active .octicon-check {
  display: block;
}</style><script>/*! @uiw/copy-to-clipboard v1.0.12 | MIT (c) 2021 Kenny Wang | https://github.com/uiwjs/copy-to-clipboard.git */
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).copyTextToClipboard=t()}(this,(function(){"use strict";return function(e,t){const o=document.createElement("textarea");o.value=e,o.setAttribute("readonly",""),o.style={position:"absolute",left:"-9999px"},document.body.appendChild(o);const n=document.getSelection().rangeCount>0&&document.getSelection().getRangeAt(0);o.select();let c=!1;try{c=!!document.execCommand("copy")}catch(e){c=!1}document.body.removeChild(o),n&&document.getSelection&&(document.getSelection().removeAllRanges(),document.getSelection().addRange(n)),t&&t(c)}}));

function copied(target, str) {
  target.classList.add('active');
  copyTextToClipboard(target.dataset.code, function() {
    setTimeout(() => {
      target.classList.remove('active');
    }, 2000);
  });
}</script></markdown-style>

</div>
<!-- Linux命令行搜索引擎：https://gitee.com/flamez57/linux-command-collection -->
<div class="footer ">
  
  <a href="../hot.html">命令列表</a>
  <br />
    
  <br /> 共搜集到
  <span id="commands_info">
    591
  </span> 个Linux命令
</div>
<script type="text/javascript" src="../js/dt.js?v=1682353717439"></script>
<script type="text/javascript" src="../js/index.js?v=1682353717439"></script>
</body>
</html>